title: Docker container cannot access internet behind cisco vpn
body: <h2>My setup:</h2>
  <ul>
  <li>Linux Mint 20</li>
  <li>Docker version 19.03.12</li>
  <li>Cisco AnyConnect 4.3.05017</li>
  </ul>
  <h2>My Issue:</h2>
  <p>When I connect to my company's VPN I cannot access the internet through my docker containers.
  e.g. running <code>docker run -it ubuntu apt update</code> will fail with the message
  &quot;Err:1 <a href="http://archive.ubuntu.com/ubuntu" rel="noreferrer">http://archive.ubuntu.com/ubuntu</a> focal InRelease<br />
  Temporary failure resolving 'archive.ubuntu.com'&quot;</p>
  <p>Disconnecting from VPN does <strong>not</strong> fix the issue. (see workaround #2)</p>
  <p>I have two workarounds:</p>
  <ol>
  <li>running docker with <code>docker run -it --net=host ubuntu apt update</code> 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.</li>
  <li>Disconnect from the VPN and run the following script (from <a href="https://github.com/moby/moby/issues/36151" rel="noreferrer">https://github.com/moby/moby/issues/36151</a>):</li>
  </ol>
  <pre><code># /bin/bash
  docker system prune -a
  systemctl stop docker
  iptables -F
  ip link set docker0 down
  brctl delbr docker0
  systemctl start docker
  </code></pre>
  <p>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.</p>
  <p>I have tried these things:</p>
  <ul>
  <li>Added DNS to daemon.json (<a href="https://stackoverflow.com/questions/20430371/my-docker-container-has-no-internet">My docker container has no internet</a>)</li>
  <li>Fixing the resolv.conf (<a href="https://stackoverflow.com/questions/20430371/my-docker-container-has-no-internet">My docker container has no internet</a>)</li>
  <li><a href="https://superuser.com/questions/1130898/no-internet-connection-inside-docker-containers">https://superuser.com/questions/1130898/no-internet-connection-inside-docker-containers</a></li>
  <li><a href="https://stackoverflow.com/questions/35519615/docker-container-can-only-access-internet-with-net-host">Docker container can only access internet with --net=host</a></li>
  <li><a href="https://stackoverflow.com/a/35519951/9496422">https://stackoverflow.com/a/35519951/9496422</a></li>
  <li>and basically any other hit on the first two pages of google searching for &quot;docker container no internet behind vpn&quot;</li>
  </ul>