1/16/2018 - 2:39 AM

On making a docker

config ip address

Modify C:\Users\<Username>\.docker\machine\machines\default\config.json docker-machine restart

  • Note that the ip address is still managed by Virtual Box DHCP, which is set in VBox->File->Preferences->Network.

config environment vars

eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)

Use mirror

docker-machine ssh

docker-machine ssh default
sudo sed -i "s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror= |g" /var/lib/boot2docker/profile
docker-machine restart default 

download image

docker pull imagine10255/centos6-lnmp-php56

file sharing

Config share folder in VBox GUI, then run following in virtual machine ssh
mkdir -p ~/docker && sudo mount -t vboxsf docker ~/docker

  • if not mounted, dir will be automaticly mounted to /docker at root in this case

create a docker container

docker run -dit -p 80:80 --mount type=bind,source=/docker,target=/home/docker imagine10255/centos6-lnmp-php56

into the docker

docker container ls
docker exec -it ??? bash