Table of Content
download docker toolbox for win
https://www.docker.com/products/docker-toolbox
- install to default location
- copy docker.exe, docker-machine.exe, docker-compose.exe to your msys2 /usr/local/bin
- uninstall docker toolbox for win
docker toolbox setting
1) make junction (directory hard link) for "Program Files", it will make easy to find VirtualBox tools
from cmd.exe
mklink /j C:\Program_Files "C:\Program Files" Junction created for C:\Program_Files > C:\Program Files mklink /j C:\Program_Files_x86 "C:\Program Files (x86)" Junction created for C:\Program_Files_x86 > C:\Program Files (x86)
2) place VirtualBox path in customized msys2 profile portabledevops.sh under /etc/profile.d/
The default docker home is based on $USERPROFILE, it is $USERPROFILE\.docker, full path like C:\Users\$USERNAME\.docker
, I prefer change to msys local home: /home//.docker
.
Here is setting lines for msys docker in portabledevops.sh:
if [ ! -d /home/$USERNAME ]; then echo "First time to run bash, create home folder: /home/$USERNAME" mkdir -p /home/$USERNAME fi export HOME=/home/$USERNAME export USERPROFILE=$HOME export HOMEPATH=$HOME cd $HOME export HOMEDRIVEL=$(cygpath -m $(pwd) |cut -d: -f1) export HOMEDRIVE=$HOMEDRIVEL: # portable docker toolbox for msys export VBOX_MSI_INSTALL_PATH=/cygdrive/c/Program_Files/Oracle/VirtualBox/ export PATH=$VBOX_MSI_INSTALL_PATH:$PATH alias dm=/usr/local/bin/docker-machine.exe alias dc=/usr/local/bin/docker-compose.exe denv(){ eval $(docker-machine env "$@") } export -f denv
docker test
1) create new docker machine
$ dm create --driver virtualbox --virtualbox-hostonly-cidr "10.0.10.1/24" msysdemo $ dm start msysdemo
2) setup env for docker client access
$ denv msysdemo denv only supports one machine, 0 or 2+ will get error as below: $ denv Error: No machine name(s) specified and no "default" machine exists. $ denv a b Error: Expected one machine name as an argument
3) docker client test
$ docker ps -a $ docker info $ docker run -it hello-world
4) ssh to docker vm
$ dm ssh msysdemo