docker learning diary (mirrored building -container commit and image build)

Construction of two ways mirror:

First, build -docker container commit According to the existing container

Second, build -docker image build according to the existing image (recommended)

 

container building

 

RUN docker - IT CentOS create a container interactively 

enter centos docker's 

yum  install - the y-install vim vim 
Exit Exit 

View container 

docker container LS -a / - A means all running or running container 

copy image you just created names 

docker the commit xenodochial_nightingale Soymilk container / centos7- vim 

xenodochial_nightingale original container name, Soymilk / centos7 vim-name for the newly created image

Use docker history id can view the entire process of building, knowing which one to build add record

image building

mkdir Soymilk 
cd Soymilk 
vim Dockerfile 

the FROM CentOS 
RUN yum  install - the y-vim 

doker Image Build .. -t Soymilk / centos3-vim-dockerfile / Dockerfile representatives refer to the current file in the directory

 

Guess you like

Origin www.cnblogs.com/soymilk2019/p/11450571.html