Docker series 6 Docker builds a private warehouse

Docker builds a private warehouse

1. Private warehouse construction

# 1、拉取私有仓库镜像 
docker pull registry
# 2、启动私有仓库容器 
docker run -id --name=registry -p 5000:5000 registry
# 3、打开浏览器 输入地址http://私有仓库服务器ip:5000/v2/_catalog,看到{"repositories":[]} 表示私有仓库 搭建成功
# 4、修改daemon.json   
vim /etc/docker/daemon.json    
# 在上述文件中添加一个key,保存退出。此步用于让 docker 信任私有仓库地址;注意将私有仓库服务器ip修改为自己私有仓库服务器真实ip 
{"insecure-registries":["121.196.111.120:5000"]} 
# 5、重启docker 服务 
systemctl restart docker
docker start registry

Pull mirror
Insert picture description here

Create a containerInsert picture description here
Insert picture description here

Trust the address of the private warehouse
Insert picture description here

2. Upload the image to the private warehouse

# 1、标记镜像为私有仓库的镜像     
docker tag centos:7 私有仓库服务器IP:5000/centos:7

Insert picture description here

# 2、上传标记的镜像     
docker push 私有仓 库服务器IP:5000/centos:7

Insert picture description here

Insert picture description here

Third, pull the image from the private warehouse

#拉取镜像 
docker pull 私有仓库服务器ip:5000/centos:7

Insert picture description here

Guess you like

Origin blog.csdn.net/pjh88/article/details/114732170