My setup:
- Linux Mint 20
- Docker version 19.03.12
- Cisco AnyConnect 4.3.05017
My Issue:
When I connect to my company's VPN I cannot access the internet through my docker containers.
e.g. running docker run -it ubuntu apt update
will fail with the message
"Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure resolving 'archive.ubuntu.com'"
Disconnecting from VPN does not fix the issue. (see workaround #2)
I have two workarounds:
- running docker with
docker run -it --net=host ubuntu apt update
will work fine, however, that is not a suitable workaround for my company's scripts and build system. It will do for ad-hoc jobs. - Disconnect from the VPN and run the following script (from https://github.com/moby/moby/issues/36151):
# /bin/bash
docker system prune -a
systemctl stop docker
iptables -F
ip link set docker0 down
brctl delbr docker0
systemctl start docker
will allow it to work again - but then I don't have access to my company's internal servers, which is also needed to build our software.
I have tried these things:
- Added DNS to daemon.json (My docker container has no internet)
- Fixing the resolv.conf (My docker container has no internet)
- https://superuser.com/questions/1130898/no-internet-connection-inside-docker-containers
- Docker container can only access internet with --net=host
- https://mcmap.net/q/373826/-docker-container-can-only-access-internet-with-net-host
- and basically any other hit on the first two pages of google searching for "docker container no internet behind vpn"