Skip to content

Instantly share code, notes, and snippets.

@tojo17
Last active January 17, 2018 03:26
Show Gist options
  • Save tojo17/17815f6c05d9b84d712f74c611b548b0 to your computer and use it in GitHub Desktop.
Save tojo17/17815f6c05d9b84d712f74c611b548b0 to your computer and use it in GitHub Desktop.

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 https://www.daocloud.io/mirror#accelerator-doc

docker-machine ssh default
sudo sed -i "s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror=http://223f5cef.m.daocloud.io |g" /var/lib/boot2docker/profile
exit
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment