Slide 27
Slide 27 text
第3章 コンテナアプリケーション開発のライフサイクル Build・Ship・Run
Dockerfile、ビルド、イメージの関係性
#ベースイメージのPull
FROM centos:7
#epel-releaseインストール
RUN yum -y install epel-release
#nginxインストール
RUN yum -y install nginx
#index.htmlを/usr/share/nginx/index.htmlにコピー
COPY index.html /usr/share/nginx/html
#nginxのフォアグラウンド処理
ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"]
Dockerfile
# docker image build -t cyberblack28/sample-nginx .
Sending build context to Docker daemon 29.18kB
Step 1/5 : FROM centos:7
・
・<省略>
・
---> 7e6257c9f8d8
Step 2/5 : RUN yum -y install epel-release
---> Running in 1a6ea01a9382
・
・<省略>
・
---> b58fcc402d22
Step 3/5 : RUN yum -y install nginx
---> Running in 9eacd9b3caa1
・
・<省略>
・
---> cc0ba96f9da7
Step 4/5 : COPY index.html /usr/share/nginx/html
---> 481e53617e12
Step 5/5 : ENTRYPOINT [“nginx”, “-g”, “daemon off;”]
---> Running in 33a4c5304825
Removing intermediate container 33a4c5304825
---> 124f75914199
Successfully built 124f75914199
Successfully tagged cyberblack28/sample-nginx:latest
ビルド
# docker image history cyberblack28/sample-nginx
IMAGE CREATED CREATED BY SIZE COMMENT
124f75914199 10 minutes ago /bin/sh -c #(nop) ENTRYPOINT ["/bin/sh" "-c… 0B
481e53617e12 10 minutes ago /bin/sh -c #(nop) COPY file:764d0af30d8866d5… 130B
cc0ba96f9da7 11 minutes ago /bin/sh -c yum -y install nginx 206MB
b58fcc402d22 11 minutes ago /bin/sh -c yum -y install epel-release 91.7MB
7e6257c9f8d8 4 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
4 weeks ago /bin/sh -c #(nop) LABEL org.label-schema.sc… 0B
4 weeks ago /bin/sh -c #(nop) ADD file:61908381d3142ffba… 203MB
イメージ
①
②
③
④
⑤
①
②
③
④
⑤
①
②
③
④
⑤