yobasystems / alpine-grav

Grav running on Alpine Linux [Docker]
https://hub.docker.com/r/yobasystems/alpine-grav/
14 stars 12 forks source link

Could not resolve host: github.com #6

Closed rlue closed 5 years ago

rlue commented 5 years ago

Just tried starting a container for this image on a Raspberry Pi 3B+, and this is the very first output from the logs:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0curl: (6) Could not resolve host: github.com
unzip:  cannot find or open /tmp/grav.zip, /tmp/grav.zip.zip or /tmp/grav.zip.ZIP.
mv: can't rename '/tmp/grav-src/grav-admin/*': No such file or directory

This was for the command

$ docker run -e VIRTUAL_HOST=<domain>.com,www.<domain>.com -v  /data/<domain>/html:/usr/html -p 8080:80 yobasystems/alpine-grav

(Port 80 is occupied on the Raspberry Pi by an existing nginx reverse proxy container.)

dominictayloruk commented 5 years ago

Try ping GitHub.com from the host

Seems like a DNS issue

rlue commented 5 years ago

Hm... the host can def. reach GitHub:

$ ping github.com
PING github.com (192.30.253.112) 56(84) bytes of data.
64 bytes from lb-192-30-253-112-iad.github.com (192.30.253.112): icmp_seq=1 ttl=46 time=230 ms
64 bytes from lb-192-30-253-112-iad.github.com (192.30.253.112): icmp_seq=2 ttl=46 time=229 ms
64 bytes from lb-192-30-253-112-iad.github.com (192.30.253.112): icmp_seq=3 ttl=46 time=229 ms
64 bytes from lb-192-30-253-112-iad.github.com (192.30.253.112): icmp_seq=4 ttl=46 time=229 ms
^C
--- github.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 229.061/229.772/230.404/0.676 ms

Seems like a DNS issue

At first, I thought it might have something to do with the fact that the host is also running Pi-Hole, with my router configured to use it as the DNS. But on an x86_64 desktop on the same network, this container runs just fine, and even when I revert the router to its original configuration (Cloudflare DNS at 1.1.1.1 / 1.0.0.1), it still doesn't work on the RPi.


I did a little more digging, and it seems I can get the container to successfully connect to the Internet if I run it in host network mode—but then it actually tries to bind to port 80, which is taken by another container:

$ docker run --net=host -e VIRTUAL_HOST=<domain>.com,www.<domain>.com -v  /data/<domain>/html:/usr/html -p 8080:80 yobasystems/alpine-grav
WARNING: Published ports are discarded when using host network mode
2019/05/24 17:43:02 [emerg] 36#36: bind() to 0.0.0.0:80 failed (98: Address in use)
2019/05/24 17:43:02 [notice] 36#36: try again to bind() after 500ms
...

Any idea why it would fail to connect to the Internet in bridge network mode?

rlue commented 5 years ago

Also, I can confirm that all my other containers can access the internet:

$ docker exec <container_name> ping google.com

works for containers based on the following images:

but doesn't work for yobasystems/alpinegrav :(

rlue commented 5 years ago

Wait! It does appear to be a DNS issue. If I add the option --dns 1.1.1.1 --dns 1.0.0.1 then it works fine!

It's very weird. The contents of /etc/resolv.conf are the same in all my containers. What would cause this image to use a different DNS from the others?

dominictayloruk commented 5 years ago

Not sure as i've just run the same command as you suggested on armhf (Asus Tinkerboard) binding port 80 in the container to 8080 on the host. I can hit the site and i see in the logs it extracting the grav admin .zip.