DockerRegistry安装使用说明

DockerRegistry安装使用说明

2023年7月6日发(作者:)

DockerRegistry安装使⽤说明⼀、环境准备Docker Registry ip addr: 192.168.232.25 hostname: registryDocker Client ip addr: 192.168.232.12 hostname: docker3# cat /etc/redhat-releaseCentOS Linux release 7.5.1804 (Core)# docker versionClient: Version: 1.13.1 API version: 1.26 Package version: .x86_64 Go version: go1.9.4 Git commit: 94f4240/1.13.1 Built: Fri May 18 15:44:33 2018 OS/Arch: linux/amd64Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Package version: .x86_64 Go version: go1.9.4 Git commit: 94f4240/1.13.1 Built: Fri May 18 15:44:33 2018 OS/Arch: linux/amd64 Experimental: false⼆、Docker Registry安装官⽅在Docker Hub上提供了Docker Registry的镜像。我们可以直接使⽤该镜像构建⼀个Registry容器来搭建我们的Registry私有仓库。# docker search registryINDEX NAME DESCRIPTION STARS OFFICIAL /registry The Docker Registry 2.0 2058 [OK] /konradkleine/docker-registry-frontend Browse and modify your Docker registry in ... 194 [OK] /hyper/docker-registry-web Web UI, authentication service and 139 [OK] /atcol/docker-registry-ui A web UI for easy private/local 106 [OK] /distribution/registry WARNING: NOT the registry official image!!... 56 [OK] /marvambass/nginx-registry-proxy Docker Registry Reverse Proxy with 43 [OK] /google/docker-registry Docker Registry w/ Google Cloud 35

/jhipster/jhipster-registry JHipster Registry, based on 25 [OK] /confluentinc/cp-schema-registry Official Confluent Docker Images 20

/deis/registry Docker image registry for the Deis 12

/joxit/docker-registry-ui Docker registry v2 web User Interface 11 [OK] /klausmeyer/docker-registry-browser Web Interface for the Docker 11 [OK] /openshift/origin-docker-registry The integrated OpenShift V3 registry 11

/landoop/schema-registry-ui UI for Confluent's Schema Registry 7 [OK] /cblomart/rpi-registry docker registry 2 for raspbery pi 5

/allingeek/registry A specialization of registry:2 configured ... 4 [OK] /elasticio/docker-registry-ecs Docker image to run Docker 4 [OK] /pallet/registry-swift Add swift storage support to the official ... 4 [OK] /aibaars/docker-registry2-gcs Docker Registry2 w/ Google Cloud 1

/metadata/registry Metadata Registry is a tool which 1 [OK] /webhippie/registry Docker images for registry 1 [OK] /convox/registry 0

启动Registry容器。# docker run -d -p 5000:5000 -v /opt/registry/data:/var/lib/registry --privileged=true --restart=always --name registry registry:latestUnable to find image 'registry:latest' locallyTrying to pull repository /library/registry ...latest: Pulling from /library/registry4064ffdc82fe: Pull completec12c92d1c5a2: Pull complete4fbc9b6835cc: Pull complete765973b0f65f: Pull complete3968771a7c3a: Pull completeDigest: sha256:003a106b827ab7f5bd7140d08020b16c87cd6bcac024b01fe6247f87632f2978Status: Downloaded newer image for /registry:lateste0e8e26f0e296868d54f53f35f55ea4c1a5b763fa7804c67ef676fa023c05d6a# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe0e8e26f0e29 registry:latest "/ /e..." 45 seconds ago Up 43 seconds 0.0.0.0:5000->5000/tcp registry

三、Docker Registry使⽤制作私有仓库镜像先从官⽅Docker Hub上拉取busybox镜像。# docker pull busyboxUsing default tag: latestTrying to pull repository /library/busybox ...latest: Pulling from /library/busybox07a152489297: Pull completeDigest: sha256:74f634b1bc1bd74535d5209589734efbd44a25f4e2dc96d78784576a3eb5b335Status: Downloaded newer image for /busybox:latest# docker imagesREPOSITORY TAG IMAGE ID CREATED /hello-world latest 2cb0d9787c4d 3 days ago 1.85 /registry latest b2b03e9146e1 7 days ago 33.3 /tomcat latest 2d084b11164d 10 days ago 463 /busybox latest 8c811b4aec35 7 weeks ago 1.15 MB修改该镜像的tag。# docker tag /busybox:latest 192.168.232.25:5000/busybox:latest# docker imagesREPOSITORY TAG IMAGE ID CREATED /hello-world latest 2cb0d9787c4d 3 days ago 1.85 /registry latest b2b03e9146e1 7 days ago 33.3 /tomcat latest 2d084b11164d 10 days ago 463 MB192.168.232.25:5000/busybox latest 8c811b4aec35 7 weeks ago 1.15 /busybox latest 8c811b4aec35 7 weeks ago 1.15 MB推送该镜像到Registry私有仓库。docker push 192.168.232.25:5000/busybox:latestThe push refers to a repository [192.168.232.25:5000/busybox]Get 192.168.232.25:5000/v1/_ping: http: server gave HTTP response to HTTPS client因为Docker与Docker Registry交互默认使⽤https,然⽽此处搭建的Docker Registry只提供http服务,所以当和Registry私有仓库交互时会失败,为了解决这个问题需要在启动Docker时配置Registry不安全选项。vi /etc/docker/{ "registry-mirrors": [ "" ], "insecure-registries":["192.168.232.25:5000"]}重启Docker,并重启registry容器。# systemctl restart docker# docker start registry重新推送busybox镜像到Registry私有仓库,并成功。# docker push 192.168.232.25:5000/busybox:latestThe push refers to a repository [192.168.232.25:5000/busybox]432b65032b94: Pushedlatest: digest: sha256:74f634b1bc1bd74535d5209589734efbd44a25f4e2dc96d78784576a3eb5b335 size: 527从私有仓库拉取镜像在Docker Client终端拉取Registry私有仓库镜像。查询Registry私有仓库镜像列表。# curl 192.168.232.25:5000/v2/_catalog{"repositories":["busybox"]}查询busybox镜像的标签列表。# curl 192.168.232.25:5000/v2/busybox/tags/list{"name":"busybox","tags":["latest"]}从Registry私有仓库拉取镜像。# docker pull 192.168.232.25:5000/busybox:latestTrying to pull repository 192.168.232.25:5000/busybox ...Get 192.168.232.25:5000/v1/_ping: http: server gave HTTP response to HTTPS client报相同的错误,请进⾏相同的配置,并重启Docker。然后重新拉取busybox镜像。# docker pull 192.168.232.25:5000/busybox:latestTrying to pull repository 192.168.232.25:5000/busybox ...latest: Pulling from 192.168.232.25:5000/busybox07a152489297: Pull completeDigest: sha256:74f634b1bc1bd74535d5209589734efbd44a25f4e2dc96d78784576a3eb5b335Status: Downloaded newer image for 192.168.232.25:5000/busybox:latest查看镜像列表。# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE192.168.232.25:5000/busybox latest 8c811b4aec35 7 weeks ago 1.15 MB四、Docker CEDocker CE没有/etc/docker/配置⽂件。请修改/usr/lib/systemd/system/e。# vi /usr/lib/systemd/system/eExecStart=/usr/bin/dockerd --registry-mirror= --insecure-registry 192.168.232.25:5000⽣效配置并重启Docker。# systemctl daemon-reload# systemctl restart docker拉取Registry私有仓库的镜像。# docker pull 192.168.197.10:5000/tomcat:latestlatest: Pulling from tomcat55cbf04beb70: Pull complete1607093a898c: Pull complete9a8ea045c926: Pull complete1290813abd9d: Pull complete8a6b982ad6d7: Pull completeabb029e68402: Pull complete8cd067dc06dc: Pull complete1b9ce2097b98: Pull completed6db5874b692: Pull complete25b4aa3d52c5: Pull complete53ec227dabf0: Pull complete242938ace8b4: Pull completeDigest: sha256:cded14cf64697961078aedfdf870e704a52270188c8194b6f70c778a8289d87eStatus: Downloaded newer image for 192.168.197.10:5000/tomcat:latest

发布者:admin,转转请注明出处:http://www.yc00.com/web/1688592275a153124.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信