Docker create a mirror and sliding Harbor

Create a mirror

 

 

First, create a mirror according to dockerfile

Detailed file

1、mkdir dockerfile/lib/centos7base/

Create a directory

2. Create Dockerfile

vim Dockerfile

 

3, the mirror Construction

docker build -t wyxcentos7 .

Process analytical
docker image is read-only, why there can be customized on the basis of operating centos mirror on it?
We look at the compilation process docker

 

 


The first step of the compiler (green border) will be before reuse existing centos: 7
focuses on the second step
882832c2b8eb is in fact centos: a temporary container is generated on the basis of 7 mirrored id
we ignore the installation of vim, jump to the last

Finally docker commit to generate the image file generated according to the temporary container, and finally delete the temporary container (blog shown started control is understood)
2, the container constructed in accordance with the mirror

 1, pull to a mirror

docker run -it centos

(run =(pull start exec))

2, View vim

 

3, a mounting vim 

yum intall vim

 

 4, Exit container

exit

 

 5, submitted by container

 

 

 

 

 

 

 

 

 

Into the container

docker exec -it 69d1 bash
quit
exit

Push the mirror to harbor

1, playing tag

docker tag wyxcentosvim:latest 192.168.31.101/library/wyxcentosvim:latest

2, Push

docker push wyxcentosvim:latest 192.168.31.101/library/wyxcentosvim:latest

docker push 192.168.31.101/library/wyxcentosvim:1.02

 

 

3, delete the local mirror

docker rmi .........

Unable to remove a mirror multiple repositories

The reason: For ImageID deleted, there is more here REPOSITORY name references. By deleting the name of the mirror.

https://blog.csdn.net/JackLiu16/article/details/80581709

4, pulling the mirror

docker pull 192.168.31.101/library/wyxcentosvim:latest

 

 

 

 

 

 

Recommended article: https: //www.jianshu.com/p/1409967439d6

 

Guess you like

Origin www.cnblogs.com/wudequn/p/11488409.html