[docker] docker private warehouse

1. Description

  • 1.Docker's official docker hub (https://hub.docker.com) is a warehouse for managing public images. You can pull images from it to the local, or you can push your own images to it.
  • 2. If the server cannot access the Internet, or if you do not want to put your own image on the public network, you need to build your own private warehouse to store and manage your own image

2. Construction of private warehouse

  • 1. Pull the private warehouse image
docker pull registry
  • 2. Start the private warehouse container
docker run -id --name=registry -p 5000:5000 registry
  • 3. Browser access
#访问地址:http://私有仓库服务器ip:5000/v2/_catalog
#看到{"repositories":[]}表示私有仓库搭建成功

insert image description here

  • 4. Modify daemon.json
vim /etc/docker/daemon.json

# 在上述文件中添加一个key,保存退出。用于让docker信任私有仓库地址;
# 注意将私有仓库服务器ip修改为自己私有仓库服务器真实ip
{“insecure-registries”: ["私有仓库服务器ip:5000"]}

insert image description here

  • 5. Restart the docker service
systemctl restart docker
docker start registry

3. Upload the image to the private warehouse

  • 1. Mark the mirror as a mirror of a private warehouse
docker tag centos:7 私有仓库服务器ip:5000/centos:7
  • 2. Upload the marked image
docker push 私有仓库服务器ip:5000/centos:7

4. Pull the image from the private warehouse

  • 1. Pull the image
docker pull 私有仓库服务器ip:5000/centos:7

Guess you like

Origin blog.csdn.net/qq_32088869/article/details/132123368
Recommended