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

  automation, docker, docker-compose, dockerfile, ubuntu

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"
    image: nginx
    container_name: nginxContainer
    image: alpine
    entrypoint: "ping nginx"   
      - nginx
    image: alpine
    working_dir: /a/b/c
    entrypoint: "wget nginx"   
      - /home/ramit/Downloads:/a/b/c
      - 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.

Screenshot Links: — Chrome Browser – Logs of docker-compose up – 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:

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