Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Dev Container suddenly cannot access Internet today #1739

Open
junwang-wish opened this issue May 3, 2023 · 2 comments
Open

Dev Container suddenly cannot access Internet today #1739

junwang-wish opened this issue May 3, 2023 · 2 comments

Comments

@junwang-wish
Copy link

I could access internet in my VScode dev container yesterday, but not today. I checked the host machine (Ec2 instance) can access internet without problem by running

curl -Is www.google.com | head -n 1
> HTTP/1.1 200 OK

Yet in the dev container, it hangs due to no access to internet.

So I decided to rebuild the dev container, without any change to my .devcontainer/devcontainer.json and made no change to my Dockerfile, but rebuild started to fail due to no access to internet (My Dockerfile needs internet to install some packages, my postCreateCommand needs internet to install Python packages):
.devcontainer/devcontainer.json:

{
	"name": "Test",
	"build": {
		"dockerfile": "../Dockerfile",
		"context": ".."
	},
	"runArgs": [ "--network", "host"],
	"postCreateCommand": "pip install pandas"
}

and
Dockerfile:

ARG VARIANT=3.8
FROM mcr.microsoft.com/devcontainers/python:0-${VARIANT}
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y install -y libsasl2-modules libsasl2-dev

Is this related to new release of VScode? How to fix it to be able to access internet inside dev container during Dockerfile build, and also post build?

I tried removing "runArgs": [ "--network", "host"] but it also results in failure to build the dev container.

@junwang-wish
Copy link
Author

This seems to only happen on my EC2 dev instance, not my Macbook, so it's extra strange

@hlafaille
Copy link

hlafaille commented Jul 10, 2023

Same thing started happening to me today. Running Debian 12 Bookworm as the host, I can build the image by hand by running docker build, but building through VSCode seems to fail with a network error. Very strange, and I'm pulling my hair out trying to get this working as I need to work... I also had --network host included in my runArgs. Did you ever find a solution to this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants