zane@zane-V:~$ docker pull ubuntu:15.04 15.04: Pulling from library/ubuntu 9502adfba7f1: Pull complete 4332ffb06e4b: Pull complete 2f937cc07b5f: Pull complete a3ed95caeb02: Pull complete Digest: sha256:2fb27e433b3ecccea2a14e794875b086711f5d49953ef173d8a03e8707f1510f Status: Downloaded newer image for ubuntu:15.04
zane@zane-V:~/mydockerbuild$ docker build -t changed-ubuntu . Sending build context to Docker daemon 2.048 kB Step 1 : FROM ubuntu:15.04 ---> d1b55fd07600 Step 2 : RUN echo "Hello world" > /tmp/newfile ---> Running in 914cfa4e2724 ---> 3a3a082982a2 Removing intermediate container 914cfa4e2724 Successfully built 3a3a082982a2
zane@zane-V:~/mydockerbuild$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE changed-ubuntu latest 3a3a082982a2 3 minutes ago 131.3 MB zane/aiapple 007 d2f5f84bec87 12 days ago 275.1 MB zane/aiapple 009 d2f5f84bec87 12 days ago 275.1 MB ziapple latest d2f5f84bec87 12 days ago 275.1 MB
zane@zane-V:~/mydockerbuild$ docker history changed-ubuntu IMAGE CREATED CREATED BY SIZE COMMENT 3a3a082982a2 6 minutes ago /bin/sh -c echo "Hello world" > /tmp/newfile 12 B d1b55fd07600 11 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B <missing> 11 months ago /bin/sh -c sed -i ‘s/^#\s*\(deb.*universe\)$/ 1.879 kB <missing> 11 months ago /bin/sh -c echo ‘#!/bin/sh‘ > /usr/sbin/polic 701 B <missing> 11 months ago /bin/sh -c #(nop) ADD file:3f4708cf445dc1b537 131.3 MB
zane@zane-V:~/mydockerbuild$ cat Dockerfile FROM changed-ubuntu RUN echo "Based on changed-ubuntu" > /tmp/new.t
zane@zane-V:~/mydockerbuild$ docker build -t bashed_on_changed-ubuntu . Sending build context to Docker daemon 2.048 kB Step 1 : FROM changed-ubuntu ---> 3a3a082982a2 Step 2 : RUN echo "Based on changed-ubuntu" > /tmp/new.t ---> Running in 0132c351fa33 ---> 93a447865aa6 Removing intermediate container 0132c351fa33 Successfully built 93a447865aa6
zane@zane-V:~/mydockerbuild$ docker history bashed_on_changed-ubuntu IMAGE CREATED CREATED BY SIZE COMMENT 93a447865aa6 29 seconds ago /bin/sh -c echo "Based on changed-ubuntu" > / 24 B 3a3a082982a2 31 minutes ago /bin/sh -c echo "Hello world" > /tmp/newfile 12 B d1b55fd07600 11 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B <missing> 11 months ago /bin/sh -c sed -i ‘s/^#\s*\(deb.*universe\)$/ 1.879 kB <missing> 11 months ago /bin/sh -c echo ‘#!/bin/sh‘ > /usr/sbin/polic 701 B <missing> 11 months ago /bin/sh -c #(nop) ADD file:3f4708cf445dc1b537 131.3 MB
zane@zane-V:~$ docker run -dit changed-ubuntu bash 9635de83c668a61be7077ad309798a686fbfe29abf5f152dc84d641dd4b84a7b zane@zane-V:~$ docker run -dit changed-ubuntu bash f92f01d11ff0d93f09ca6b94ebda3b699dc959297cf90565acf7f337d1c8af03 zane@zane-V:~$ docker run -dit changed-ubuntu bash a341fec4b3604a21dda733839cfea56005712335daa8344ece0a22c4df53076a zane@zane-V:~$ docker run -dit changed-ubuntu bash 54b836a993084953972507015515ad4a9c8c779508ad1a581a7b50fa0a496f42 zane@zane-V:~$ docker run -dit changed-ubuntu bash 7f3ea62f1430b20ab7948281d88ef96140a688cf7bd08454c40ce1ad3d057620
zane@zane-V:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7f3ea62f1430 changed-ubuntu "bash" 3 minutes ago Up 3 minutes berserk_borg 54b836a99308 changed-ubuntu "bash" 3 minutes ago Up 3 minutes condescending_mccarthy a341fec4b360 changed-ubuntu "bash" 3 minutes ago Up 3 minutes ecstatic_saha f92f01d11ff0 changed-ubuntu "bash" 3 minutes ago Up 3 minutes hungry_mestorf 9635de83c668 changed-ubuntu "bash" 3 minutes ago Up 3 minutes
$ sudo ls /var/lib/docker/containers
原文:http://www.cnblogs.com/Aiapple/p/6971292.html