1. Install boot2docker
Download the installer
https://github.com/boot2docker/windows-installer/releases
This will install boot2docker, VirtualBox and git for windows
2. Start the boot2docker
Execute "Git Bash"
$ boot2docker start
$ boot2docker ip
Using the ip address to login boot2docker vm
3. Using putty to login boot2docker vm
IP: (get from previous step)
port: 22
username: docker
password: tcuser
4. create a my-data container to share folder & a samba container
$ docker run -v /data --name my-data busybox true
$ docker run --rm -v /usr/local/bin/docker:/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba my-data
(you can access share file in /(boot2docker's ip)/data in host windows)
5. Run a ubuntu container
$ docker run -it --volumes-from=my-data ubuntu
$
(you will in the container, using ctrl+p ctrl+q to detach)
6. check all container status
$ docker ps -a
(container id will be list)
7. Attach previous ubuntu container
$ docker attach [Container ID]
(just key-in the few heading numbers of container ID is OK)
8. Start playing around in container (in container)
$ apt-get update
$ apt-get install xxxxx
$ exit
(Will back to boot2docker vm)
9. Commit the container to a image
$ docker commit [Contain ID] your_name/image_name:tag
10. List all docker images
$ docker images
(previous commit image will be list)
11. Run a new container on new created image
$ docker run -it --volumes-from=my-data your_name/image_name:tag
$ exit
12. Delete container
$ docker rm [Container ID]
13. Delete image
$ docker rmi [image_name]
14. Back to "Git Bash", save the status of boot2docker
$ boot2docker save
(running status of boot2docker vm is saved)
15. resume boot2docker vm
$ boot2docker up
沒有留言:
張貼留言