vscode-dev-containers icon indicating copy to clipboard operation
vscode-dev-containers copied to clipboard

No Internet in Dev Container When Specifying Network name

Open RLashofRegas opened this issue 3 years ago • 2 comments

  • VSCode Version: 1.67.2
  • Local OS Version: Windows 10 21H2 Build 19044.1708, running WSL v2 Ubuntu 20.04
  • Local chip architecture: x86
  • Reproduces in: Remote - Containers
  • Name of Dev Container Definition with Issue: Docker for Docker Compose

Steps to Reproduce:

  1. Setup new dev container using the Docker for Docker Compose definition
  2. In the docker-compose.yml for the dev container add this to the app service:
    networks:
      - my-network

and add this at the bottom of the file:

networks:
  my-network
    name: my-network
    driver: bridge

(for reference this is done so that later when I spin up my app with docker-compose I can attach it to the same network using the external configuration which allows port forwards to work correctly within my WSL instance) 3. start up the dev container 4. within the dev container from bash run curl google.com 5. returns could not resolve hostname 6. if you comment out the name config above and run everything again you get a valid response

RLashofRegas avatar May 24 '22 22:05 RLashofRegas

@chrmarti any thoughts?

bamurtaugh avatar Jun 01 '22 17:06 bamurtaugh

This should work. Maybe my-network already exists and has some custom configuration preventing it from connecting to the outside?

chrmarti avatar Jun 03 '22 10:06 chrmarti