#### Getting error "This site can’t be reached" for many sites after running docker-compose.yml

Issue: Whenever I run a docker-compose.yml file with command “docker-compose up”, few websites like github and stackoverflow keeps on loading and after few minutes throws an error “This site can’t be reached”/”ERR_TIMED_OUT”, while websites like google and youtube works fine. Below is the docker-compose.yml file.

version: "3"
services:
nginx:
image: nginx
container_name: nginxContainer
alpine1:
image: alpine
entrypoint: "ping nginx"
depends_on:
- nginx
alpine2:
image: alpine
working_dir: /a/b/c
entrypoint: "wget nginx"
volumes:
depends_on:
- nginx


When I run the same images via terminal using docker run image command, all websites work fine. The issue is only when I run docker-compose file. I am using latest version of docker and docker-compose.

OS – Ubuntu- 18.04.4 LTS (Bionic Beaver)

This issue exist is both browsers i.e. chrome and firefox. Have tried incognito mode as well, didn’t worked.

https://ibb.co/82ZRSWR — Chrome Browser

https://ibb.co/h2LtcWJ – Logs of docker-compose up

https://ibb.co/0synCv8 – Firefox Browser

As a part of solution of above issue, I have tried restarting the docker service, making docker-compose down, nothing works. It only starts working whenever I restart my system.

I found the same issue mentioned here as well: https://github.com/docker/compose/issues/3633

The solution given in this is to remove tty:true from docker-compose.yml file, but I never used that in my file. I have even tried adding tty:false in my docker-compose.yml file, but doesn’t worked.

Would be really great if anyone can help me through it.

Many Thanks

Source: Docker Questions