Implementation of private image warehouse based on docker registry


The image of the micro service will be uploaded to the docker warehouse for storage. Common public network docker warehouses include Alibaba cloud, Netease cloud, etc. you can also build your own docker private warehouse on the enterprise LAN. This tutorial uses the private warehouse registry provided by docker.

1. Pull private warehouse image

docker pull registry

2. Create and start the private warehouse container

docker run -dit -v /data/registry:/var/lib/registry -p 5000:5000 --restart=always --name docker-registry registry

Parameter description

  • -DIT: open a pseudo terminal in the container for interactive operation, and run in the background
  • -v: Mount the host’s / data / registry directory to the container’s / var / lib / registry directory (this directory is the directory where the image files are stored in the registry container) to realize data persistence
  • -p: If you map the port, you can access the service of the registry container by accessing the 5000 port of the host
  • –Restart = always: This is the restart policy. If the container exits abnormally, it will restart automatically
  • –Name docker registry: create a container named docker registry. You can name it as you like
  • Registry: the image pulled down

The above shows that the registry image has been created and the docker registry container has been started successfully. visit: The response results are as follows:


The above response result shows that there is no image in the docker private warehouse.

By default, docker registry only allows images to be submitted by HTTPS. The following configuration enables docker registry to support HTTP. Under / etc / docker, create a daemon.json file and write it to:

 "insecure-registries": [ ""]

3. Restart docker

systemctl restart docker

4. Upload the image to the private warehouse

Mark this image as a private warehouse image

docker tag

Image of upload tag

docker push

List all images

[[email protected] docker]# curl

The above is the whole content of this article, I hope to help you learn, and I hope you can support developer more.

Recommended Today

Programming Xiaobai must understand the network principle

How is the network composed? Why can we easily surf the Internet now?Whether you are a computer major or not, you may always have such questions in your heart!And today we will solve this matter and tell you the real answer! Basic composition of network First, let’s look at this sentence Connect all computers together […]