I cannot reach external network from docker-compose containers.
Consider the following docker-compose file:
version: \'2\'
services:
The last time I had a problem like that, I solved it like this:
https://github.com/docker/docker/issues/866#issuecomment-19218300
pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d
It will force docker to recreate the bridge and reinit all the network rules.
As for reasons why this happens, I don't have good answers. But I did recently trace the problem back to journald
. When I restart journald
(for example because I changed its config), DNS resolution inside docker-compose containers consistently/reproducibly breaks. I don't know why exactly, I can only say that this is a reliable way for me to reproduce it on RHEL.
EDIT The docker -d
command might not work for you based on the version of docker you are using but don't worry about it, you can omit that command.