Building a private warehouse with docker container

1, About registry

  • The official Dockerhub is a good place to manage the public image. We can find the image we want on it or push our own image up. However, sometimes our server cannot access the Internet, or you do not want to put your own image on the public network, then you need Docker
    Registry, which can be used to store and manage its own images.

2, Set up a registry

1. Download the registry image

The official package is ready
[root@docker-server ~]# docker pull registry 
[root@docker-server ~]# docker images|grep re
registry            latest              2e2f252f3c88        3 hours ago         33.3MB

2. Start the container

[root@docker-server ~]# docker run -d -p 5000:5000 --name registry --restart=always registry
6661bdede4232eafe04b9def983cbc69290e124840e98489f4737399c892619e
[root@docker-server ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
6661bdede423        registry            "/entrypoint.sh /etc..."   21 seconds ago      Up 20 seconds       0.0.0.0:5000->5000/tcp   registry

3. Solve the problem of push ssl

[root@docker-server ~]# cat /etc/docker/daemon.json 
{
    "insecure-registries": ["10.0.0.5:5000"] 
}

4. Upload image

[root@docker-server ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
mynginxv2           latest              8d8392ece54b        4 hours ago         293MB
registry            latest              2e2f252f3c88        4 hours ago         33.3MB
nginx               latest              06144b287844        7 days ago          109MB
centos              latest              5182e96772bf        5 weeks ago         200MB
[root@docker-server ~]# docker tag 8d8392ece54b 10.0.0.5:5000/mynginx:v2
[root@docker-server ~]# docker push 10.0.0.5:5000/mynginx:v2
The push refers to repository [10.0.0.5:5000/mynginx]
fda1a926f8fe: Pushed 
dfb930f142ab: Pushed 
f5bede261df7: Pushed 
0b60ed8a7a2c: Pushed 
1d31b5806ba4: Pushed 
v2: digest: sha256:9d7d95fdb245cf19a02038ff814fb460679f464ca80d7ff71eac390317d1590a size: 1367

5. View all image information in the Registry

[root@docker-server ~]# curl http://10.0.0.5:5000/v2/_catalog
{"repositories":["mynginx"]}

Keywords: Docker SSL network JSON

Added by RaheimSG on Tue, 31 Dec 2019 23:37:10 +0200