An Example of Enterprise Building Doker Private Service

Posted by stitchmedia on Thu, 03 Oct 2019 13:32:35 +0200

Enterprises Build Doker Private Service

Article directory

1 Create Private Service

1.1 Pull out the mirror

[root@localhost ~]# docker pull docker.io/registry
Using default tag: latest
Trying to pull repository docker.io/library/registry ... 
latest: Pulling from docker.io/library/registry
c87736221ed0: Pull complete 
1cc8e0bb44df: Pull complete 
54d33bcb37f5: Pull complete 
e8afc091c171: Pull complete 
b4541f6d3db6: Pull complete 
Digest: sha256:8004747f1e8cd820a148fb7499d71a76d45ff66bac6a29129bfdbfdc0154d146
Status: Downloaded newer image for docker.io/registry:latest

1.2 Create Containers

[root@localhost ~]# docker run -di -p 5000:5000 --name=liubijun_registry registry
6027eda46ab74bdb30ec6de362d354161a8098af84f96938c667c1326418779c



1.3 validation

http://192.168.85.198:5000/v2/_catalog

1.4 results

1.5 Configuration of Private Warehouses

Modify daemon.json, content: {"insecure registries": ["192.168.184.135:5000"]}

”Note ": this step is used to let docker trust the private warehouse address

[root@localhost ~]# vi /etc/docker/daemon.json
[root@localhost ~]# cat /etc/docker/daemon.json 
{"registry-mirrors":["http://docker.mirrors.ustc.edu.cn"],
"insecure-registries":["192.168.85.198:5000"]
}
[root@localhost ~]# systemctl  restart docker
[root@localhost ~]# 

1.6 Hand-upload Mirrors to Private Clothes

1) Mark this image as a private warehouse image

[root@localhost ~]# docker tag jdk1.8 192.168.85.198:5000/jdk1.8
[root@localhost ~]# docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
jdk1.8                       latest              88a34dbcd5f0        About an hour ago   589 MB
192.168.85.198:5000/jdk1.8   latest              88a34dbcd5f0        About an hour ago   589 MB
mynginx_1.0                  latest              242f3c6e0f81        4 months ago        109 MB
docker.io/nginx              latest              27a188018e18        4 months ago        109 MB
docker.io/tomcat             latest              5a069ba3df4d        5 months ago        465 MB
docker.io/mongo              latest              b1c8142b3efc        5 months ago        410 MB
docker.io/zookeeper          latest              2a7f6fc5c8a1        5 months ago        150 MB
docker.io/redis              latest              a55fbf438dfd        5 months ago        95 MB
docker.io/mysql              latest              7bb2586065cd        5 months ago        477 MB
docker.io/centos             latest              9f38484d220f        6 months ago        202 MB
docker.io/registry           latest              f32a97de94e1        6 months ago        25.8 MB
docker.io/lwieske/java-8     latest              ac36fa5aed45        7 months ago        163 MB
rabbitmq                     management          df80af9ca0c9        13 months ago       149 MB
elasticsearch                5.6.8               6c0bdf761f3b        18 months ago       570 MB
mobz/elasticsearch-head      5                   b19a5c98e43b        2 years ago         824 MB

2) Upload Markup Mirror

[root@localhost ~]# docker push 192.168.85.198:5000/jdk1.8
The push refers to a repository [192.168.85.198:5000/jdk1.8]
d6faa6f536ab: Pushed 
10cc74d0d651: Pushed 
d69483a6face: Pushed 
latest: digest: sha256:38b804ff9d40f52231f5ba437b55cfdd98ff6fb0235900952e3ab78d2fbc4da7 size: 949
[root@localhost ~]# 

3) Download Mirror

[root@localhost ~]# docker pull 192.168.85.198:5000/jdk1.8


1.7 test

Test whether the image is uploaded to a private warehouse

Topics: Docker JSON ElasticSearch Nginx