Notes-Building and using docker-registry private image warehouse

Notes-Building and using docker-registry private image warehouse

Pull/install the registry image and corresponding UI image

If there is a network, you can pull the image directly

docker pull registry
docker pull hyper/docker-registry-web

If there is no network, you can use the offline image tar package I exported, download address https://wwzt.lanzoul.com/i3im1194z12d

docker load -i docker-reg-repo.tar
docker load -i docker-reg-ui.tar

给load好的镜像按镜像id 设置对应的tag标签

docker tag  w23er2rwr21r  registry:3.0.0
docker tag  tr23rweq2e1d  registry-ui:3.0.0

Create and run docker container

Start the docker-registry container first

docker run -d -p 5000:5000 -v /var/my_registry/:/var/lib/registry  --name mydocker-reg-repo   --privileged=true registry:3.0.0

Then start the registry-ui container

docker run -d -p 5001:8080 --name reg-web-ui --restart=always --link mydocker-reg-repo -e registry_url=http://192.168.11.131:5000/v2 -e registry_name=localhost:5000  registry-ui:3.0.0

###Test access to port 5000

http://192.168.11.131:5000/v2/_catalog

Will return json data such as

{
    
    "repositories":["myrepo/cs-docker-demo","myrepo/myapp","myrepo/openjdk","myrepo/redis"]}

###Test access to port 5001

http://192.168.11.131:5001/

Will return to the Web Registry page
Please add image description

Push the existing docker image to the newly built private warehouse

First configure the docker server and let docker register to 192.168.11.131:5000

Use vi to edit the daemon.json file

vi /etc/docker/daemon.json

The content of the file is as follows

{
    
    
 "hosts":[
    "unix://var/run/docker.sock",
    "tcp://0.0.0.0:2375"
  ],
  "insecure-registries":["192.168.11.131:5000"]
}

After configuration, first stop all running docker containers, and then restart the docker service.

Modify the tag of an existing image in docker to a tag that conforms to the docker private warehouse specification

规范: docker tag 老tag  私仓ip:私仓port/自定义仓库名/镜像名:镜像版本号

Examples are as follows

docker tag  rabbitmq:3.1.0   192.168.11.131:5000/myrepo/rabbitmq:3.1.0

Please add image description

Push the image to the docker-registry private docker image warehouse based on the tag just now

docker push  192.168.11.131:5000/myrepo/rabbitmq:3.1.0

Please add image description

Please add image description

Guess you like

Origin blog.csdn.net/ThinkPet/article/details/133063795