Docker command
Eric Ahn
2016/05
hello-nginx Dockerfile
$ vi Dockerfile
FROM ubuntu:14.04
MAINTAINER Foo Bar <foo@bar.com>
RUN apt-get update
RUN apt-get install -y nginx
RUN echo "ndaemon off;" >> /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/lib/nginx
VOLUME ["/data", "/etc/nginx/site-enabled", "/var/log/nginx"]
WORKDIR /etc/nginx
CMD ["nginx"]
EXPOSE 80
EXPOSE 443
step1
step2
step3
step4
step5
step6
step7
step8
step9
step10
step11
$ docker build —tag hello:0.1 .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM ubuntu:14.04
14.04: Pulling from library/ubuntu
6599cadaf950: Pull complete
23eda618d451: Pull complete
f0be3084efe9: Pull complete
52de432f084b: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:15b79a6654811c8d992ebacdfbd5152fcf3d165e374e264076aa435214a947a3
Status: Downloaded newer image for ubuntu:14.04
---> 90d5884b1ee0
Step 2 : MAINTAINER Foo Bar <foo@bar.com>
---> Running in 0f6a06fe4714
---> da79740af78d
Removing intermediate container 0f6a06fe4714
Step 3 : RUN apt-get update
---> Running in 4d96969f6245
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]
Get:3 http://archive.ubuntu.com trusty Release.gpg [933 B]
Get:4 http://archive.ubuntu.com trusty Release [58.5 kB]
Get:5 http://archive.ubuntu.com trusty-updates/main Sources [346 kB]
Get:6 http://archive.ubuntu.com trusty-updates/restricted Sources [5217 B]
Get:7 http://archive.ubuntu.com trusty-updates/universe Sources [195 kB]
Get:8 http://archive.ubuntu.com trusty-updates/main amd64 Packages [964 kB]
Get:9 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [23.5 kB]
Get:10 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [465 kB]
Get:11 http://archive.ubuntu.com trusty-security/main Sources [147 kB]
Get:12 http://archive.ubuntu.com trusty-security/restricted Sources [3920 B]
Get:13 http://archive.ubuntu.com trusty-security/universe Sources [42.7 kB]
Get:14 http://archive.ubuntu.com trusty-security/main amd64 Packages [602 kB]
Get:15 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [20.2 kB]
Get:16 http://archive.ubuntu.com trusty-security/universe amd64 Packages [168 kB]
Get:17 http://archive.ubuntu.com trusty/main Sources [1335 kB]
Get:18 http://archive.ubuntu.com trusty/restricted Sources [5335 B]
Get:19 http://archive.ubuntu.com trusty/universe Sources [7926 kB]
Get:20 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]
Get:21 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]
Get:22 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]
Fetched 21.8 MB in 40s (542 kB/s)
Reading package lists...
---> 10c685744ed4
Removing intermediate container 4d96969f6245
Step 4 : RUN apt-get install -y nginx
---> Running in 11b02f8ee345
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
fontconfig-config fonts-dejavu-core geoip-database libfontconfig1
libfreetype6 libgd3 libgeoip1 libjbig0 libjpeg-turbo8 libjpeg8 libtiff5
Step 5 : RUN echo "ndaemon off;" >> /etc/nginx/nginx.conf
---> Running in 0d6c5151966d
---> 1f167b0a39a3
Removing intermediate container 0d6c5151966d
Step 6 : RUN chown -R www-data:www-data /var/lib/nginx
---> Running in 19abc00dc949
---> f2c6ffc2f95d
Removing intermediate container 19abc00dc949
Step 7 : VOLUME /data /etc/nginx/site-enabled /var/log/nginx
---> Running in 9ed5de33cd83
---> 1b38c26b24fb
Removing intermediate container 9ed5de33cd83
Step 8 : WORKDIR /etc/nginx
---> Running in 1668da3366d5
---> 0be42e5bf5c2
Removing intermediate container 1668da3366d5
Step 9 : CMD nginx
---> Running in 361ad937396e
---> 3664b1f5c5f7
Step 10 : EXPOSE 80
---> Running in 085ff2b47ff1
---> d7111e6f6b1a
Removing intermediate container 085ff2b47ff1
Step 11 : EXPOSE 443
---> Running in 836593b6df28
---> c50c1b568757
Removing intermediate container 836593b6df28
Successfully built c50c1b568757
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello 0.1 c50c1b568757 22 seconds ago 227.9 MB
ubuntu 14.04 90d5884b1ee0 3 weeks ago 188 MB
$ docker history hello:0.1
IMAGE CREATED CREATED BY SIZE COMMENT
c50c1b568757 41 seconds ago /bin/sh -c #(nop) EXPOSE 443/tcp 0 B
d7111e6f6b1a 41 seconds ago /bin/sh -c #(nop) EXPOSE 80/tcp 0 B
3664b1f5c5f7 41 seconds ago /bin/sh -c #(nop) CMD ["nginx"] 0 B
0be42e5bf5c2 42 seconds ago /bin/sh -c #(nop) WORKDIR /etc/nginx 0 B
1b38c26b24fb 42 seconds ago /bin/sh -c #(nop) VOLUME [/data /etc/nginx/si 0 B
f2c6ffc2f95d 42 seconds ago /bin/sh -c chown -R www-data:www-data /var/li 0 B
1f167b0a39a3 42 seconds ago /bin/sh -c echo "ndaemon off;" >> /etc/nginx 1.614 kB
19099969214f 42 seconds ago /bin/sh -c apt-get install -y nginx 18.15 MB
10c685744ed4 About a minute ago /bin/sh -c apt-get update 21.79 MB
da79740af78d About a minute ago /bin/sh -c #(nop) MAINTAINER Foo Bar <foo@bar 0 B
90d5884b1ee0 3 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
<missing> 3 weeks ago /bin/sh -c sed -i 's/^#s*(deb.*universe)$/ 1.895 kB
<missing> 3 weeks ago /bin/sh -c rm -rf /var/lib/apt/lists/* 0 B
<missing> 3 weeks ago /bin/sh -c set -xe && echo '#!/bin/sh' > /u 194.5 kB
<missing> 3 weeks ago /bin/sh -c #(nop) ADD file:b64f702c5b33d12426 187.8 MB
$ docker run --name hello-nginx -d -p 80:80 -v /Users/EricAhn/_Docker/example/data:/data hello:0.1
$ vi ./data/aaa.txt
iiiii
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1262901819bd hello:0.1 "nginx" 26 seconds ago Up 26 seconds 0.0.0.0:80->80/tcp, 443/tcp hello-nginx
$ docker exec -it 1262901819bd bash
root@1262901819bd:/etc/nginx# cd /data
root@1262901819bd:/data# ls -la
total 8
drwxr-xr-x 1 1000 staff 102 May 25 15:45 .
drwxr-xr-x 46 root root 4096 May 25 15:44 ..
-rw-r--r-- 1 1000 staff 4 May 25 15:45 aaa.txt
root@1262901819bd:/data# exit
exit
$
$ docker cp hello-nginx:/etc/nginx/nginx.conf ./
$ ls -la
total 16
drwxr-xr-x 5 EricAhn staff 170 May 26 00:46 .
drwxr-xr-x 3 EricAhn staff 102 May 26 00:35 ..
-rw-r--r-- 1 EricAhn staff 316 May 26 00:36 Dockerfile
drwxr-xr-x 3 EricAhn staff 102 May 26 00:45 data
-rw-r--r-- 1 EricAhn staff 1614 May 26 00:41 nginx.conf
$ docker commit -a "Foo Bar <foo@bar.com>" -m "add hello.txt" hello-nginx hello:0.2
sha256:0702722ac15ba37a725c6211cf4ce329833ec5b2f69ef5913cc5a1ac227fa6c5
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello 0.2 0702722ac15b 18 seconds ago 227.9 MB
hello 0.1 c50c1b568757 5 minutes ago 227.9 MB
ubuntu 14.04 90d5884b1ee0 3 weeks ago 188 MB
$ docker diff hello-nginx
A /data
C /etc
C /etc/nginx
A /etc/nginx/site-enabled
C /root
A /root/.bash_history
C /run
A /run/nginx.pid
C /var
C /var/lib
C /var/lib/nginx
A /var/lib/nginx/body
A /var/lib/nginx/fastcgi
A /var/lib/nginx/proxy
A /var/lib/nginx/scgi
A /var/lib/nginx/uwsgi
$ docker inspect hello-nginx
[
{
"Id": "1262901819bd5e2a68fb227386bac81dd7da438267f50215d6acd4cc5da4077a",
"Created": "2016-05-25T15:44:57.096609197Z",
"Path": "nginx",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 3622,
"ExitCode": 0,
"Error": "",
"StartedAt": "2016-05-25T15:44:57.205263081Z",
"FinishedAt": "0001-01-01T00:00:00Z"
}
…

More Related Content

PDF
Docker remote-api
PDF
Docker deploy
PDF
Automating Mendix application deployments with Nix
PDF
Docker e postgresql
PPTX
Real World Lessons on the Pain Points of Node.js Applications
PDF
How to create your own hack environment
PPTX
Running Docker in Development & Production (#ndcoslo 2015)
PPTX
Lessons from running potentially malicious code inside containers
Docker remote-api
Docker deploy
Automating Mendix application deployments with Nix
Docker e postgresql
Real World Lessons on the Pain Points of Node.js Applications
How to create your own hack environment
Running Docker in Development & Production (#ndcoslo 2015)
Lessons from running potentially malicious code inside containers

What's hot (20)

PDF
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
PPTX
Docker practice
PDF
CoreOS + Kubernetes @ All Things Open 2015
PDF
Fabric workshop(1) - (MOSG)
PDF
Docker, c'est bonheur !
PPTX
Lessons from running potentially malicious code inside Docker containers
PDF
Docker perl build
PDF
Preparation study of_docker - (MOSG)
PDF
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
PDF
MeaNstack on Docker
PPTX
Start tracking your ruby infrastructure
PDF
Vagrant for real (codemotion rome 2016)
PDF
Docker 101 - from 0 to Docker in 30 minutes
PPTX
Running .NET on Docker
PDF
Hyperledger composer
PDF
Docker / Ansible
PPTX
Plone deployment made easy
PDF
(Re)discover your AEM
PDF
How to stay sane during your Vagrant journey
PPTX
Infrastructure as code - Python Saati #36
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker practice
CoreOS + Kubernetes @ All Things Open 2015
Fabric workshop(1) - (MOSG)
Docker, c'est bonheur !
Lessons from running potentially malicious code inside Docker containers
Docker perl build
Preparation study of_docker - (MOSG)
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
MeaNstack on Docker
Start tracking your ruby infrastructure
Vagrant for real (codemotion rome 2016)
Docker 101 - from 0 to Docker in 30 minutes
Running .NET on Docker
Hyperledger composer
Docker / Ansible
Plone deployment made easy
(Re)discover your AEM
How to stay sane during your Vagrant journey
Infrastructure as code - Python Saati #36

Viewers also liked (12)

PDF
Http capturing
PDF
Py conkr 20150829_docker-python
PDF
High perforance-browse-networking-2015-bwahn
PDF
Cdn gslb-20151209
PDF
Keep it simple web development stack
PDF
Spring rest-doc-2015-11
PDF
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
PDF
Py conkr 20150829_docker-python
PDF
Tensorflow in Docker
PDF
[코세나, kosena] 빅데이터 구축 및 제안 가이드
PDF
Swift server-side-let swift2016
PDF
Docker Meetup: Docker Networking 1.11 with Madhu Venugopal
Http capturing
Py conkr 20150829_docker-python
High perforance-browse-networking-2015-bwahn
Cdn gslb-20151209
Keep it simple web development stack
Spring rest-doc-2015-11
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
Py conkr 20150829_docker-python
Tensorflow in Docker
[코세나, kosena] 빅데이터 구축 및 제안 가이드
Swift server-side-let swift2016
Docker Meetup: Docker Networking 1.11 with Madhu Venugopal

Similar to Docker command (20)

PDF
Hands-On Session Docker
PPTX
How To Run Nginx in a Docker Container on Ubuntu 16.04
PPTX
PDF
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
PDF
Docker 初探,實驗室中的運貨鯨
PPTX
Powercoders · Docker · Fall 2021.pptx
PPTX
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
PPSX
Docker and containers - Presentation Slides by Priyadarshini Anand
PDF
Docker, the Future of DevOps
PPTX
Webapp using docker container
PDF
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
PDF
Docker From Scratch
PPT
Docker 101, Alexander Ryabtsev
PPTX
Dockerizing a Symfony2 application
PPTX
Getting Started with Docker
PDF
How to deploy PHP projects with docker
PDF
Docker.pdf
PDF
Docker Demo @ IuK Seminar
PDF
Introduction of Docker and Docker Compose
PDF
Présentation de Docker
Hands-On Session Docker
How To Run Nginx in a Docker Container on Ubuntu 16.04
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
Docker 初探,實驗室中的運貨鯨
Powercoders · Docker · Fall 2021.pptx
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker, the Future of DevOps
Webapp using docker container
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Docker From Scratch
Docker 101, Alexander Ryabtsev
Dockerizing a Symfony2 application
Getting Started with Docker
How to deploy PHP projects with docker
Docker.pdf
Docker Demo @ IuK Seminar
Introduction of Docker and Docker Compose
Présentation de Docker

Recently uploaded (20)

PDF
Build Real-Time ML Apps with Python, Feast & NoSQL
PDF
EIS-Webinar-Regulated-Industries-2025-08.pdf
PDF
Examining Bias in AI Generated News Content.pdf
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
NewMind AI Journal Monthly Chronicles - August 2025
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Streamline Vulnerability Management From Minimal Images to SBOMs
PDF
Altius execution marketplace concept.pdf
PDF
substrate PowerPoint Presentation basic one
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PPTX
Blending method and technology for hydrogen.pptx
PDF
Identification of potential depression in social media posts
PPTX
Information-Technology-in-Human-Society.pptx
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PDF
CEH Module 2 Footprinting CEH V13, concepts
PPTX
How to use fields_get method in Odoo 18
Build Real-Time ML Apps with Python, Feast & NoSQL
EIS-Webinar-Regulated-Industries-2025-08.pdf
Examining Bias in AI Generated News Content.pdf
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
NewMind AI Journal Monthly Chronicles - August 2025
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
A symptom-driven medical diagnosis support model based on machine learning te...
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Streamline Vulnerability Management From Minimal Images to SBOMs
Altius execution marketplace concept.pdf
substrate PowerPoint Presentation basic one
Lung cancer patients survival prediction using outlier detection and optimize...
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
Build automations faster and more reliably with UiPath ScreenPlay
Blending method and technology for hydrogen.pptx
Identification of potential depression in social media posts
Information-Technology-in-Human-Society.pptx
Rapid Prototyping: A lecture on prototyping techniques for interface design
CEH Module 2 Footprinting CEH V13, concepts
How to use fields_get method in Odoo 18

Docker command

  • 2. hello-nginx Dockerfile $ vi Dockerfile FROM ubuntu:14.04 MAINTAINER Foo Bar <[email protected]> RUN apt-get update RUN apt-get install -y nginx RUN echo "ndaemon off;" >> /etc/nginx/nginx.conf RUN chown -R www-data:www-data /var/lib/nginx VOLUME ["/data", "/etc/nginx/site-enabled", "/var/log/nginx"] WORKDIR /etc/nginx CMD ["nginx"] EXPOSE 80 EXPOSE 443 step1 step2 step3 step4 step5 step6 step7 step8 step9 step10 step11
  • 3. $ docker build —tag hello:0.1 . Sending build context to Docker daemon 2.048 kB Step 1 : FROM ubuntu:14.04 14.04: Pulling from library/ubuntu 6599cadaf950: Pull complete 23eda618d451: Pull complete f0be3084efe9: Pull complete 52de432f084b: Pull complete a3ed95caeb02: Pull complete Digest: sha256:15b79a6654811c8d992ebacdfbd5152fcf3d165e374e264076aa435214a947a3 Status: Downloaded newer image for ubuntu:14.04 ---> 90d5884b1ee0 Step 2 : MAINTAINER Foo Bar <[email protected]> ---> Running in 0f6a06fe4714 ---> da79740af78d Removing intermediate container 0f6a06fe4714
  • 4. Step 3 : RUN apt-get update ---> Running in 4d96969f6245 Ign http://archive.ubuntu.com trusty InRelease Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB] Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB] Get:3 http://archive.ubuntu.com trusty Release.gpg [933 B] Get:4 http://archive.ubuntu.com trusty Release [58.5 kB] Get:5 http://archive.ubuntu.com trusty-updates/main Sources [346 kB] Get:6 http://archive.ubuntu.com trusty-updates/restricted Sources [5217 B] Get:7 http://archive.ubuntu.com trusty-updates/universe Sources [195 kB] Get:8 http://archive.ubuntu.com trusty-updates/main amd64 Packages [964 kB] Get:9 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [23.5 kB] Get:10 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [465 kB] Get:11 http://archive.ubuntu.com trusty-security/main Sources [147 kB] Get:12 http://archive.ubuntu.com trusty-security/restricted Sources [3920 B] Get:13 http://archive.ubuntu.com trusty-security/universe Sources [42.7 kB] Get:14 http://archive.ubuntu.com trusty-security/main amd64 Packages [602 kB] Get:15 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [20.2 kB]
  • 5. Get:16 http://archive.ubuntu.com trusty-security/universe amd64 Packages [168 kB] Get:17 http://archive.ubuntu.com trusty/main Sources [1335 kB] Get:18 http://archive.ubuntu.com trusty/restricted Sources [5335 B] Get:19 http://archive.ubuntu.com trusty/universe Sources [7926 kB] Get:20 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB] Get:21 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB] Get:22 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB] Fetched 21.8 MB in 40s (542 kB/s) Reading package lists... ---> 10c685744ed4 Removing intermediate container 4d96969f6245 Step 4 : RUN apt-get install -y nginx ---> Running in 11b02f8ee345 Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: fontconfig-config fonts-dejavu-core geoip-database libfontconfig1 libfreetype6 libgd3 libgeoip1 libjbig0 libjpeg-turbo8 libjpeg8 libtiff5
  • 6. Step 5 : RUN echo "ndaemon off;" >> /etc/nginx/nginx.conf ---> Running in 0d6c5151966d ---> 1f167b0a39a3 Removing intermediate container 0d6c5151966d Step 6 : RUN chown -R www-data:www-data /var/lib/nginx ---> Running in 19abc00dc949 ---> f2c6ffc2f95d Removing intermediate container 19abc00dc949 Step 7 : VOLUME /data /etc/nginx/site-enabled /var/log/nginx ---> Running in 9ed5de33cd83 ---> 1b38c26b24fb Removing intermediate container 9ed5de33cd83 Step 8 : WORKDIR /etc/nginx ---> Running in 1668da3366d5 ---> 0be42e5bf5c2 Removing intermediate container 1668da3366d5 Step 9 : CMD nginx ---> Running in 361ad937396e ---> 3664b1f5c5f7
  • 7. Step 10 : EXPOSE 80 ---> Running in 085ff2b47ff1 ---> d7111e6f6b1a Removing intermediate container 085ff2b47ff1 Step 11 : EXPOSE 443 ---> Running in 836593b6df28 ---> c50c1b568757 Removing intermediate container 836593b6df28 Successfully built c50c1b568757
  • 8. $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello 0.1 c50c1b568757 22 seconds ago 227.9 MB ubuntu 14.04 90d5884b1ee0 3 weeks ago 188 MB
  • 9. $ docker history hello:0.1 IMAGE CREATED CREATED BY SIZE COMMENT c50c1b568757 41 seconds ago /bin/sh -c #(nop) EXPOSE 443/tcp 0 B d7111e6f6b1a 41 seconds ago /bin/sh -c #(nop) EXPOSE 80/tcp 0 B 3664b1f5c5f7 41 seconds ago /bin/sh -c #(nop) CMD ["nginx"] 0 B 0be42e5bf5c2 42 seconds ago /bin/sh -c #(nop) WORKDIR /etc/nginx 0 B 1b38c26b24fb 42 seconds ago /bin/sh -c #(nop) VOLUME [/data /etc/nginx/si 0 B f2c6ffc2f95d 42 seconds ago /bin/sh -c chown -R www-data:www-data /var/li 0 B 1f167b0a39a3 42 seconds ago /bin/sh -c echo "ndaemon off;" >> /etc/nginx 1.614 kB 19099969214f 42 seconds ago /bin/sh -c apt-get install -y nginx 18.15 MB 10c685744ed4 About a minute ago /bin/sh -c apt-get update 21.79 MB da79740af78d About a minute ago /bin/sh -c #(nop) MAINTAINER Foo Bar <foo@bar 0 B 90d5884b1ee0 3 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B <missing> 3 weeks ago /bin/sh -c sed -i 's/^#s*(deb.*universe)$/ 1.895 kB <missing> 3 weeks ago /bin/sh -c rm -rf /var/lib/apt/lists/* 0 B <missing> 3 weeks ago /bin/sh -c set -xe && echo '#!/bin/sh' > /u 194.5 kB <missing> 3 weeks ago /bin/sh -c #(nop) ADD file:b64f702c5b33d12426 187.8 MB
  • 10. $ docker run --name hello-nginx -d -p 80:80 -v /Users/EricAhn/_Docker/example/data:/data hello:0.1 $ vi ./data/aaa.txt iiiii $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1262901819bd hello:0.1 "nginx" 26 seconds ago Up 26 seconds 0.0.0.0:80->80/tcp, 443/tcp hello-nginx $ docker exec -it 1262901819bd bash root@1262901819bd:/etc/nginx# cd /data root@1262901819bd:/data# ls -la total 8 drwxr-xr-x 1 1000 staff 102 May 25 15:45 . drwxr-xr-x 46 root root 4096 May 25 15:44 .. -rw-r--r-- 1 1000 staff 4 May 25 15:45 aaa.txt root@1262901819bd:/data# exit exit $
  • 11. $ docker cp hello-nginx:/etc/nginx/nginx.conf ./ $ ls -la total 16 drwxr-xr-x 5 EricAhn staff 170 May 26 00:46 . drwxr-xr-x 3 EricAhn staff 102 May 26 00:35 .. -rw-r--r-- 1 EricAhn staff 316 May 26 00:36 Dockerfile drwxr-xr-x 3 EricAhn staff 102 May 26 00:45 data -rw-r--r-- 1 EricAhn staff 1614 May 26 00:41 nginx.conf
  • 12. $ docker commit -a "Foo Bar <[email protected]>" -m "add hello.txt" hello-nginx hello:0.2 sha256:0702722ac15ba37a725c6211cf4ce329833ec5b2f69ef5913cc5a1ac227fa6c5 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello 0.2 0702722ac15b 18 seconds ago 227.9 MB hello 0.1 c50c1b568757 5 minutes ago 227.9 MB ubuntu 14.04 90d5884b1ee0 3 weeks ago 188 MB
  • 13. $ docker diff hello-nginx A /data C /etc C /etc/nginx A /etc/nginx/site-enabled C /root A /root/.bash_history C /run A /run/nginx.pid C /var C /var/lib C /var/lib/nginx A /var/lib/nginx/body A /var/lib/nginx/fastcgi A /var/lib/nginx/proxy A /var/lib/nginx/scgi A /var/lib/nginx/uwsgi
  • 14. $ docker inspect hello-nginx [ { "Id": "1262901819bd5e2a68fb227386bac81dd7da438267f50215d6acd4cc5da4077a", "Created": "2016-05-25T15:44:57.096609197Z", "Path": "nginx", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 3622, "ExitCode": 0, "Error": "", "StartedAt": "2016-05-25T15:44:57.205263081Z", "FinishedAt": "0001-01-01T00:00:00Z" } …