Continue, this article describes the simplest steps of building a private warehouse.
For the summary:
- Install the registry image and start the container.
- CA certificate (There is also a way to directly use HTTP also line, you can omit this step)
- Make the image, publish it.
The simplest way to install registry is to pull a ready-made registry image directly.
docker pull registry
Then start it.
-p5000:5000-v /home/registry:/tmp/registry registry
Exposes 5000 ports for external service, while loading the host's/home/registry directory as a warehouse directory.
Now you can push your own image to this warehouse, you need to first give a mirror tag, and then push it, the command is as follows:
docker tag java:7-jre hub.wo.cnpush hub.wo.cn/yancheng/java
At this point, a security error must be reported:
From the error description, there are two solutions, one is to use HTTP, and the other is to install the CA certificate.
Method one, configured as HTTP, the speed will be slightly faster, but also simple. Just modify the/etc/default/docker file, plus one sentence:
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=hub.open.wo.cn"
Then restart Docker, sudo service docker restart
and the normal push will be done.
Method Two, configure the security certificate, slightly cumbersome, especially our Docker registry behind Nginx.
First, you need to generate your own certificate (to operate on the server) with the following command:
openssl genrsa -des3 -out hub.key2048openssl rsa -in hub.key -out hub_nopwd.keyopenssl req -new -key hub_nopwd.key -out hub.csr3650 -in hub.csr -signkey hub_nopwd.key -out hub.crt
Then, we configure the Nginx to increase the support for HTTPS.
server { listen 443; server_name hub.wo.cn; ssl on; ssl_certificate /usr/local/nginx/conf/hub.crt; ssl_certificate_key /usr/local/nginx/conf/hub_nopwd.key; / { proxy_pass http://10.250.251.20:5000; proxy_redirect off; $host; proxy_set_header x-forwarded-for$remote_addr; }}
Note the location of the HUB.CRT and Hub_nopwd.key. Restart Nginx.
Now, you need to get this hub.crt locally, and follow the previous prompts in the appropriate directory. That is: /etc/docker/certs.d/hub.open.wo.cn
.
Restart Docker again, and push is normal.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the Docker: private warehouse building, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.