docker-adminer icon indicating copy to clipboard operation
docker-adminer copied to clipboard

adminer does not start when IPv6 is not supported

Open mschaefers opened this issue 8 years ago • 5 comments

when running adminer on a host that has IPv6 disabled, the container fails to start with

Failed to listen on :::8080 (reason: php_network_getaddresses: getaddrinfo failed: Name does not resolve)
Unknown: php_network_getaddresses: getaddrinfo failed: Name does not resolve in <b>Unknown</b> on line <b>0</b><br />

Expected: The container must start and listen to IPv4 0.0.0.0:8080

mschaefers avatar Mar 22 '18 11:03 mschaefers

PHP's internal webserver requires me to explicitely specify a bind host (i.e. I cannot just provide a port). In #10 I specifically changed the Dockerfile to bind to ::, instead of 0.0.0.0. In the default configuration of net.ipv6.bindv6only = 0 this will bind both IPv4 as well as IPv6.

If you absolutely cannot enable IPv6 on that host you can:

  1. Use the fastcgi version of the image, which should work.
  2. Specify the CMD when running the Docker image: docker run … adminer:standalone php -S 0.0.0.0:8080 -t /var/www/html
  3. Create your own Docker image based on adminer, overriding the CMD:
FROM	adminer:standalone
CMD	[ "php", "-S", "0.0.0.0:8080", "-t", "/var/www/html" ]

TimWolla avatar Mar 22 '18 11:03 TimWolla

2. docker run … adminer:standalone php -S 0.0.0.0:8080 -t /var/www/html

@TimWolla does it work with --net=host option?

I tried

both docker run --net=host adminer and docker run --net=host adminer php -S 0.0.0.0:8080 -t /var/www/html.

Both of them will say started successfully but none of them can actually accessible by navigate to http://localhost:8080.

Jeff-Tian avatar Mar 24 '20 11:03 Jeff-Tian

@TimWolla does it work with --net=host option?

It works for me:

[timwolla@~]docker run -it --rm --net=host adminer
[Tue Mar 24 11:38:45 2020] PHP 7.4.2 Development Server (http://[::]:8080) started
[Tue Mar 24 11:38:53 2020] [::ffff:127.0.0.1]:50742 Accepted
[Tue Mar 24 11:38:53 2020] [::ffff:127.0.0.1]:50742 [200]: GET /
[Tue Mar 24 11:38:53 2020] [::ffff:127.0.0.1]:50742 Closing

and

[timwolla@~]curl localhost:8080
<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex">
<title>Login - Adminer</title>

TimWolla avatar Mar 24 '20 11:03 TimWolla

Hi,

this error occurred to me after updating Docker Desktop for Mac (edge channel) to latest version (2.2.3.0), which has reported problem in IPv6 networking:

Loopback and unspecified IPv6 addresses (:: and ::1) within a container do not currently work. Some web servers and other programs may be using these addresses in their configuration files.

See https://docs.docker.com/docker-for-mac/edge-release-notes/#known-issues.

Solutions suggested by @TimWolla works, but I had problems in other containers as well so I tried downgrading back to 2.2.2.0 which solved networking issues for me as well as this one.

Hope it helps

klobinoid avatar Apr 10 '20 09:04 klobinoid

For the docker-compose aficionados:

version: "3.8"

services:
    adminer:
        command: php -S 0.0.0.0:8080 -t /var/www/html
        depends_on:
            - db
        image: adminer:4.7.7-standalone
        networks:
            blah:
        ports:
            - "8080:8080"
    db:
        image: postgres:12.3
        networks:
            blah:
        volumes:
            - ./db/data/:/var/lib/postgresql/data/:rw

networks:
    blah:

bor8 avatar Jul 08 '20 15:07 bor8