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.
Use registry set up docker PW warehouse
- First, pull the mirror registry
- Second, the container according to a start image
- Third, a random access PW interface, see if you can return data
- Fourth, push a mirror to their own PW in
- 1, pull a hello-world image
- 2, to make a tag this image
- 3, to push the mirror in his private servers
- 4, the mirror pulled from the PW
- V. Notes
- 1, if you want to be pushed to your private servers, you'll need to mirror while playing tag with `ip [domain name]: Port 'as a prefix
- 2, if the push mirroring fails, may need to modify `/ usr / lib / systemd / system / docker.service` profile
- 3, `47.101.130.164` for the address of the server where I docker registry
- 4, the local version, use the docker is `19.03.1`
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:5000
The 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/registry
Loading data represents the interior of the container to its own data volumeregistry-huan
in
Third, a random access PW interface, see if you can return data
http://47.101.130.164:5000/v2/_catalog
注意:
The repositories
reason 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.164
this is where my registry ip address of the machine
2, 5000
to 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
- Solutions are as follows
description | operating |
---|---|
1, the increase follows the file vim /usr/lib/systemd/system/docker.service | --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
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.service
the configuration file
3, 47.101.130.164
Docker 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