Use registry set up docker PW warehouse

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/fu_huo_1993/article/details/101100402


By default, we pull docker mirroring mostly from dockerhub pulled, but there are times when some of our own internal mirror is built, do not want to disclose to others to use, so this time we need to build its own mirror image of the PW, the docker provides just, registry mirror, just can use to build their own private servers.

First, pull the mirror registry

docker pull registry

Second, the container according to a start image

1, create a data volume

docker volume create registry-huan

2, start the container

docker run -d -p 5000:5000 --restart=always -v registry-huan:/var/lib/registry --name registry-huan registry
  • -p 5000:5000The port 5000 port 5000 inside the container is exposed to the outside
  • --restart=always Represents an error is encountered automatic restart
  • --name After executing the startup of the vessel name
  • -v registry-huan:/var/lib/registryLoading data represents the interior of the container to its own data volume registry-huanin

Third, a random access PW interface, see if you can return data

http://47.101.130.164:5000/v2/_catalog

Return data
注意:The repositoriesreason why there will be data, because before I upload a hello-world of Mirror

Fourth, push a mirror to their own PW in

1, pull a hello-world image

docker pull hello-world

2, to make a tag this image

docker tag hello-world  47.101.130.164:5000/hello-world

注意:
1, 47.101.130.164this is where my registry ip address of the machine
2, 5000to start the registry of foreign exposed port

3, to push the mirror in his private servers

docker push 47.101.130.164:5000/hello-world
  • In this step, you may report the following error
    push error
  • Solutions are as follows
description operating
1, the increase follows the file vim /usr/lib/systemd/system/docker.service Modify the configuration file --insecure-registry 47.101.130.164:5000
2, restart docker systemctl daemon-reload
systemctl restart docker.service
3, the implementation docker push xxx again will find you can push the

4, the mirror pulled from the PW

docker pull 47.101.130.164:5000/hello-world-new

Mirror Pull

V. Notes

1, if you want to be pushed to your private servers, you'll need to mirror while playing tag with ip[域名]:端口prefixed

2, if push the mirror fails, you may need to modify /usr/lib/systemd/system/docker.servicethe configuration file

3, 47.101.130.164Docker address of the server registry is where I

4, the local version of the operating use docker 19.03.1

[root@huan1993 ~]# docker -v
Docker version 19.03.1, build 74b1e89

Guess you like

Origin blog.csdn.net/fu_huo_1993/article/details/101100402