Monday, January 11, 2016

Docker inside corporate VPN Network


If you are trying to create a docker machine and use docker within a corporate VPN network it might not work straight out of an example. 
Following steps would help. When we are creating docker machine, we would need to specify proxy information so that docker can then connect to Docker Hub.

Create docker machine as follows:
$docker-machine create --driver=virtualbox --virtualbox-memory=4096 --virtualbox-cpu-count=2 \
--engine-env HTTP_PROXY=http://proxy.yourorg.com:8989 \
--engine-env HTTPS_PROXY=http://proxy.yourorg.com:8989 \
--engine-env NO_PROXY=localhost,127.0.0.1,localaddress,.localdomain.com,.local,127.0.0.0/8 \
office


Then go to the docker machine VM on VirtualBox and you would need to do port forwarding.
  1. Go to the VM on virtual box machine and go to Settings>Network
  2. For Adapter1, open Port Forwarding and add port forwarding information. (You can get your machine IP and port information using ` $docker-machine env office` command )

















Once port forwarding information is saved, on terminal run following commands

$ eval "$(docker-machine env office)”
$ export DOCKER_HOST=tcp://127.0.0.1:2376
--disable TLS security if you get certificate error when you do $ docker ps
$ alias docker="docker --tlsverify=false"

Now commands like $ docker ps and $ docker search <image> would work.



If you are working outside of office network, offline at home, then you can create a docker machine without proxy information. Use this machine when offline.

$docker-machine create --driver=virtualbox --virtualbox-memory=4096 --virtualbox-cpu-count=2 \
default

No comments:

Post a Comment