I am using a WSL2 (Ubuntu-20.04) setup to run docker (v24.0.2)
In this particular environment I am not able to access the internet unless through proxy.
when I run below commands
Docker build --tag my-docker-image --file Dockerfile .
Docker run -it --rm --name my-docker-container-wsl my-docker-image
I am brough into the container in a bash terminal, but as soon as I type.
W: Failed to fetch http ://deb.debian.org/debian/dists/bullseye/InRelease Could not connect to 0.0.0.0:3128 (0.0.0.0). - connect (111: Connection refused)
W: Failed to fetch http ://deb.debian.org/debian-security/dists/bullseye-security/InRelease Unable to connect to 0.0.0.0:3128:
W: Failed to fetch http ://deb.debian.org/debian/dists/bullseye-updates/InRelease Unable to connect to 0.0.0.0:3128:
W: Some index files failed to download. They have been ignored, or old ones used instead.
I am at a bit of a loss why Linux is able to use the proxy but the docker container is being denied permissions.
I would like to mention that i started docker using
sudo service docker start
I have modifed /etc/default/docker with
export http_proxy=‘http ://0.0.0.0:3128’
export https_proxy=‘http ://0.0.0.0:3128’
“httpProxy”: “http ://0.0.0.0:3128”,
“httpsProxy”: “http ://0.0.0.0:3128”