Docker study notes (3)-DoctorFile

table of Contents

Official documentation

DockerFile basics

Dockefile execution process

The difference between DockerFile, image and container

Dockerfile architecture

New dockerfile

Custom Tomcat image

Recommended blog


Official document description:

https://docs.docker.com/engine/reference/builder/


Basic knowledge of DockerFile:


Dockefile execution process :


The difference between DockerFile, image and container :


Dockerfile architecture:

Create a new dockerfile:

 

FROM centos                           #如果本地不存在基础镜像,会自动下载
MAINTAINER layman<[email protected]>     #设置作者
ENV BABYPATH /usr/local/layman        #设置环境变量
WORKDIR $BABYPATH                     #设置工作目录
VOLUME ["$BABYPATH/laymanVolume"]     #设置数据卷
RUN yum -y install vim                #安装vim命令
EXPOSE 520                            #暴露端口520,憋说话,吻我
CMD echo "listen to me , oh my baby------"
CMD /bin/bash

Build the image: 

docker build -f /usr/local/layman/dockerfile -t centos:baby .

 

View the history of mirroring changes:

 

# 假设有一个镜像名叫layman,它的Dockerfile中有这么一句话 ONBULID run echo "I'm your son"
# 假设有个镜像依据layman构建(FROM layman),那么会触发ONBULID命令 trigger

Custom Tomcat image :

After the Tomcat container is started, you can synchronize web applications through the data volume function.


Recommended blog :

https://docs.docker.com/engine/reference/builder/

https://blog.csdn.net/wo18237095579/article/details/80540571

Guess you like

Origin blog.csdn.net/single_0910/article/details/113558099