microsoft / vscode-dev-containers

NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
https://aka.ms/vscode-remote
MIT License
4.72k stars 1.4k forks source link

No Internet in Dev Container When Specifying Network name #1470

Open RLashofRegas opened 2 years ago

RLashofRegas commented 2 years ago

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
bamurtaugh commented 2 years ago

@chrmarti any thoughts?

chrmarti commented 2 years ago

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