Private warehouse service side: 12.40
[[Email Protected]_golang ~]# Docker run-d-P 5000:5000-v/opt/data/registry:/tmp/registry-dev--name docker-registry re gistry:2.4
[[Email Protected]_golang ~]# Docker PS
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
CEBB252856B1 registry:2.4 "/bin/registry serve" 3 seconds ago up 2 seconds 0.0.0.0:5000->5000/tcp docker-registry
Allow pull and push operations on the same machine, this step needs to be configured on the client, and now this is the server side and the client
[Email Protected]_golang ~]# Vi/usr/lib/systemd/system/docker.service
[Unit] Description=docker Application Container Enginedocumentation=https://docs.docker.comafter=network.target Docker.socketrequires=docker.socket#execstart=/usr/bin/docker daemon-h fd://#Delegate =yes#[service]type= Notifynotifyaccess=allenvironmentfile=-/etc/sysconfig/dockerenvironment=gotraceback=crashexecstart=/bin/sh-c '/ Usr/bin/docker Daemon $OPTIONS ' limitnofile=1048576limitnproc=1048576limitcore=infinitymountflags= slavetimeoutstartsec=0restart=on-failurestandardoutput=nullstandarderror=null[install]wantedby= Multi-user.target
[Email protected] ~]# grep-v "^#"/etc/sysconfig/docker
Docker_cert_path=/etc/docker
or modify/usr/lib/systemd/system/docker.service
Execstart=/usr/bin/docker daemon--insecure-registry 172.16.160.45:5000 $OPTIONS ' $DOCKER _storage_options $DOCKER _network_options $ADD _registry $BLOCK _registry $INSECURE _registry
[Email Protected]_golang ~]# systemctl daemon-reload
[Email protected]_golang ~]# systemctl Restart Docker
[[Email Protected]_golang ~]# Docker start Docker-registry
[[Email Protected]_golang ~]# Docker PS
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
CEBB252856B1 registry:2.4 "/bin/registry serve" 8 minutes ago up 4 seconds 0.0.0.0:5000->5000/tcp Docker-registry
#上传镜像至仓库
[Email Protected]_golang ~]# Docker pull Nginx
[Email Protected]_golang ~]# Docker tag Nginx 192.168.12.40:5000/nginx
[[Email Protected]_golang ~]# Docker push 192.168.12.40:5000/nginx
#查看仓库里的镜像
[[Email Protected]_golang ~]# curl-x GET http://192.168.12.40:5000/v2/_catalog-k
{"Repositories": ["Nginx"]}
[[Email Protected]_golang ~]# curl-x GET http://192.168.12.40:5000/v2/nginx/tags/list-k
{"Name": "Nginx", "tags": ["latest"]}
Docker Registry Private Warehouse deployment