Thursday, April 16, 2015

Docker, MacOS & Cisco AnyConnect VPN

If you are unsuccessfully trying to use Docker on your Mac, and you are using the Cisco AnyConnect VPN, you have come to the right place :-)

Docker, if you don't already know, is gaining more and more traction in the industry as the best open platform for distributed applications.  There are all sorts of advantages to using Docker over say a traditional Virtual Machine.  If you haven't already, you should definitely check out the many online resources explaining Docker.  There are many good videos on YouTube.

Now back to the point of this blog post :-)  After learning a bunch about Docker, I was excited and decided to give it a whirl on my own.  Docker uses features of the Linux OS, so it only works on Linux natively.  However, there is an install for Mac OS, which leverages VirtualBox to install a Virtual Linux Machine to host the Docker containers.  The tool you install on your Mac is called "boot2docker", and it's all documented right here: http://docs.docker.com/installation/mac/

Unfortunately, it didn't go as smoothly as advertised.  Networking between the Mac OS and the Linux Virtual Machine just wouldn't work.  But as it turns out that's not Dockers fault, after much Googling I figured out it's the Cisco VPN AnyConnect that was causing the issue.  So if you are remotely working via VPN, it won't work.  The details for the issue can be found online, but in short, AnyConnect captures all traffic from 192.168.59 which Docker uses to communicate with the Virtual Machine.

I tried all sorts of fixes and suggestions online, but nothing worked.  After a few hours of struggling, I finally stumbled upon this gem of a script that fixes the issue.  All you have to do is run it before you connect to the VPN, and like magic, Docker works!


Happy Dockering and I hope I saved you the hassles I had to go through ;-)

No comments:

Post a Comment