Docker build private warehouse --Daoker

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )

1. Download Docker private warehouse Mirror

[root@instance-mtfsf05r ~]# docker pull registry

2, start the instance of a private warehouse container

[root@instance-mtfsf05r ~]# docker run -d -p 5000:5000 -v /opt/data/registry:/var/lib/registry registry

Private repository will be created in the vessel /var/lib/registry, the -v parameters are stored by the image file to the local /opt/data/registry, the container port 5000 is mapped to the host port 5000.

3, see the operating status of private container warehouse

[root@instance-mtfsf05r ~]# docker ps

4, a local mirror of modifying tag

Modifying tag local mirror of the mirror to the local repository to facilitate push:

[root@instance-mtfsf05r ~]# docker tag registry 106.12.115.123:5000/registry

5, the container connection test is normal

[root@instance-mtfsf05r ~]# telnet 106.12.115.136 5000
Here Insert Picture Description

6, so allowing HTTPS to push the mirror Docker

By Docker configuration option to cancel non-HTTPS is not allowed to push mirroring the way the default rule, modify the configuration file /etc/docker/daemon.json:

[root@instance-mtfsf05r ~]# vim /etc/docker/daemon.json

change into:

{
"registry-mirrors": ["http://f1361db2.m.daocloud.io"],
"insecure-registries":["106.12.115.136:500"]
}

Docker modify service configuration file, writes the following:

EnvironmentFile=/etc/docker/daemon.json

Here Insert Picture Description
Note that to be written [Serveice] configuration block, loading a configuration file (daemon.json).

7, reload docker

[root@instance-mtfsf05r ~]# systemctl daemon-reload

8, restart the service Docker

[root@instance-mtfsf05r ~]# systemctl restart docker

9, open container instance private warehouse

Since the restart of the Docker, all containers mirroring all instances be closed, so the need to open the container instance private warehouse.
View records private container warehouse:

[root@instance-mtfsf05r ~]# docker ps -a

Start container instances:

[root@instance-mtfsf05r ~]# docker start 2522102623c2(2522102623c2 a container ID)

10, push local mirror to a private warehouse

[root@instance-mtfsf05r ~]# docker push 106.12.115.123:5000/hello-world

11, pushed to the private view mirror warehouse

http://106.12.115.123:5000/v2/

12, download the image from a private warehouse

[root@instance-mtfsf05r ~]# docker pull 106.12.115.136:5000/hello-world

Guess you like

Origin blog.csdn.net/Thanlon/article/details/93139422