{"id":2974,"date":"2014-12-12T13:15:29","date_gmt":"2014-12-12T19:15:29","guid":{"rendered":"http:\/\/benincosa.com\/?p=2974"},"modified":"2014-12-12T13:23:24","modified_gmt":"2014-12-12T19:23:24","slug":"boot2docker-with-cisco-anyconnect","status":"publish","type":"post","link":"https:\/\/benincosa.com\/?p=2974","title":{"rendered":"Boot2Docker with Cisco AnyConnect"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/boot2docker\/osx-installer\/releases\">Boot2Docker<\/a>\u00a0is\u00a0an OS X app used to create a virtual environment for docker. \u00a0Docker only runs on Linux, so Boot2Docker installs a VM on your mac (using virtual box) and a client that runs locally to communicate with the VM.<\/p>\n<p>I downloaded this and followed instructions. \u00a0You basically just install it with a few clicks. \u00a0Once installed, boot2docker will be in your application folder. \u00a0You click on it and it in the applications folder and you are ready to go. \u00a0It kicks off its own terminal window. \u00a0Since I use iTerm2, I just start it like so:<\/p>\n<p><span class=\"lang:default decode:true  crayon-inline \">boot2docker up<\/span><\/p>\n<p>This will give you a few environment variables to export:<\/p>\n<pre class=\"lang:default decode:true \">export DOCKER_HOST=tcp:\/\/192.168.59.103:2376\r\nexport DOCKER_CERT_PATH=\/Users\/vallard\/.boot2docker\/certs\/boot2docker-vm\r\nexport DOCKER_TLS_VERIFY=1<\/pre>\n<p>This starts up a VM and Docker daemon that can be used to work with docker.<\/p>\n<p>Once this was up, I ran: <span class=\"lang:default decode:true  crayon-inline \">docker run hello-world<\/span>\u00a0. This gave me a friendly message that everything was up. So, following its suggestion, I ran <span class=\"lang:default decode:true  crayon-inline\">docker run -it &#8211;rm ubuntu bash<\/span>\u00a0. This took a bit longer to finish as it had to download the ubuntu image. \u00a0Subsequent launches take less than a second.<\/p>\n<p>There is another project called <a href=\"https:\/\/kitematic.com\">KiteMatic<\/a>\u00a0I dabbled with, but was happy enough with Boot2Docker that I didn&#8217;t bother pursuing\u00a0\u00a0it.<\/p>\n<h3><strong>Cisco AnyConnect VPN problem:<\/strong><\/h3>\n<p>There is an issue\u00a0with using boot2docker and Cisco AnyConnect\u00a0VPN. \u00a0Basically its this: \u00a0You can&#8217;t run any docker commands because AnyConnect doesn&#8217;t allow any split tunneling.<\/p>\n<p>What&#8217;s worse, is that after terminating a VPC session with AnyConnect (disconnecting), I have to reestablish a static route so that I can talk to boot2docker again:<\/p>\n<pre class=\"lang:default decode:true\">sudo route -nv add -net 192.168.59 -interface vboxnet0<\/pre>\n<p>To get around this the fix is to route your docker calls through your localhost. \u00a0That way, regardless of whether you are connected to the VPN or on an island somewhere (or both) you can still connect.<\/p>\n<h4>1. Start from scratch<\/h4>\n<p><span class=\"lang:default decode:true  crayon-inline \">boot2docker delete<\/span><\/p>\n<h4>2. \u00a0Create new boot2docker image<\/h4>\n<p><span class=\"lang:default decode:true  crayon-inline \">boot2docker init<\/span><\/p>\n<h4>3. \u00a0Edit VirtualBox and edit settings for NAT.<\/h4>\n<p><a href=\"http:\/\/benincosa.com\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-12-at-11.05.41-AM.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2975\" src=\"http:\/\/benincosa.com\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-12-at-11.05.41-AM.png\" alt=\"Screen Shot 2014-12-12 at 11.05.41 AM\" width=\"1326\" height=\"1040\" \/><\/a><\/p>\n<p>Select &#8216;Port Forwarding&#8217;<\/p>\n<h4>4. \u00a0Add the Docker port forwarding.<\/h4>\n<p><a href=\"http:\/\/benincosa.com\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-12-at-11.08.04-AM.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2976\" src=\"http:\/\/benincosa.com\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-12-at-11.08.04-AM.png\" alt=\"Screen Shot 2014-12-12 at 11.08.04 AM\" width=\"1258\" height=\"634\" \/><\/a><\/p>\n<p>Click ok and exit VirtualBox.<\/p>\n<h4>5. Start up the Docker VM<\/h4>\n<pre class=\"striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false lang:default decode:true \">boot2docker start\r\naiting for VM and Docker daemon to start...\r\n........................ooooooooooooooooooooo\r\nStarted.\r\nWriting \/Users\/vallard\/.boot2docker\/certs\/boot2docker-vm\/ca.pem\r\nWriting \/Users\/vallard\/.boot2docker\/certs\/boot2docker-vm\/cert.pem\r\nWriting \/Users\/vallard\/.boot2docker\/certs\/boot2docker-vm\/key.pem\r\n\r\nTo connect the Docker client to the Docker daemon, please set:\r\n    export DOCKER_HOST=tcp:\/\/192.168.59.105:2376\r\n    export DOCKER_CERT_PATH=\/Users\/vallard\/.boot2docker\/certs\/boot2docker-vm\r\n    export DOCKER_TLS_VERIFY=1<\/pre>\n<h4>\u00a06. \u00a0Export localhost:<\/h4>\n<pre class=\"striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false lang:default decode:true \">export DOCKER_HOST=tcp:\/\/127.0.0.1:2376\r\nexport DOCKER_CERT_PATH=\/Users\/vallard\/.boot2docker\/certs\/boot2docker-vm\r\nexport DOCKER_TLS_VERIFY=1<\/pre>\n<h4>\u00a07. \u00a0Drawbacks and Caveats<\/h4>\n<p>Now you have exposed Docker to the world. \u00a0For any service that you put on there, like when you launch docker -p 80:80, you&#8217;ll have to go into virtual box and map 80 to 80 so that it shows up. \u00a0Not the greatest solution, but at least it works!<\/p>\n<p>Credits: <a href=\"https:\/\/github.com\/boot2docker\/boot2docker\/issues\/392#issuecomment-62318587\">boot2docker github tracker @jchauncey<\/a>\u00a0and @nickmarden. Thanks guys!!!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Boot2Docker\u00a0is\u00a0an OS X app used to create a virtual environment for docker. \u00a0Docker only runs on Linux, so Boot2Docker installs a VM on your mac (using virtual box) and a client that runs locally to communicate with the VM. I downloaded this and followed instructions. \u00a0You basically just install it with a few clicks. \u00a0Once&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[478],"tags":[592,991,1011],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/2974"}],"collection":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2974"}],"version-history":[{"count":3,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/2974\/revisions"}],"predecessor-version":[{"id":2980,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/2974\/revisions\/2980"}],"wp:attachment":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}