Tool | |
---|---|
name | Docker |
logo | |
logourl | |
website | https://www.docker.com/ |
wikipediaurl | https://en.wikipedia.org/wiki/Docker_%28software%29 |
stackoverflow link | http://stackoverflow.com/questions/tagged/docker |
no of stackoverflow questions | 49,616 |
Category | Build |
pollResult |
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
upgrade docker machine
docker-machine upgrade default
list running docker processes
bash-3.2$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
get and start the latest ubuntu image
docker run ubuntu
see which images are available
bash-3.2$ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ubuntu latest 0a17decee413 4 days ago 188.4 MB bash-3.2$
start a bash shall in ubuntu
docker run -i -t ubuntu /bin/bash
modify the image by creating new directory
root@84506e084bb9:/#touch /test
look at processes again and check the difference of the image with the given container id
bash-3.2$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
84506e084bb9 ubuntu "/bin/bash" 2 minutes ago Up 2 minutes pensive_wozniak
bash-3.2$ docker diff 84506e084bb9
A /test
install some software
root@84506e084bb9:/#apt-get install php5
root@84506e084bb9:/#apt-get install mysql-server
commit the changes to images with the name "lamp" and check the image list again
bash-3.2$ docker commit 84506e084bb9 lamp
8ba719cd9b0eae589b70f6b6ddd567b4c20f997fc2d8f4c6feb313d73c2d5c3a
bash-3.2$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
lamp latest 8ba719cd9b0e 20 seconds ago 349.5 MB
ubuntu latest 0a17decee413 4 days ago 188.4 MB
bash-3.2$
docker version
Client:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 18:01:15 UTC 2015
OS/Arch: darwin/amd64
Server:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 18:01:15 UTC 2015
OS/Arch: linux/amd64
Use the nginx image from https://github.com/docker-library/docs/tree/master/nginx
docker run --name icon_html -v /Users/wf/Documents/workspace/com.bitplan.icons/src/main/resources/com/bitplan/icons:/usr/share/nginx/html:ro -d -p 8080:80 nginx
find out the ip address for the mapping (Mac OS X)
docker-machine env default
export DOCKER_HOST="tcp://192.168.99.100:2376"
try out via
http://192.168.99.100:8080/48x48/shadow/wrench.png
The process can be automated using a Dockerfile