500.【registry】 搭建docker私有堆栈

分享
开发者 2024-9-3 12:59:03 77 0 来自 中国
一、下载 registry 压缩包

1.png wget https://github.com/distribution/distribution/releases/download/v2.8.1/registry_2.8.1_linux_amd64.tar.gz二、解压 registry 压缩包,并复制到 /usr/bin/ 目次下

[root@qijing0 workspace_registry]# tar -zxvf registry_2.8.1_linux_amd64.tar.gz LICENSEREADME.mdregistrymv registry /usr/bin/三、创建设置文件

[root@qijing0 workspace_registry]# mkdir -p /etc/docker/registry[root@qijing0 workspace_registry]# cat> /etc/docker/registry/config.yml <<EOFversion: 0.1log:  fields:    service: registrystorage:  cache:    blobdescriptor: inmemory  filesystem:    rootdirectory: /var/lib/registryhttp:  addr: :5000  headers:    X-Content-Type-Options: [nosniff]health:  storagedriver:    enabled: true    interval: 10s    threshold: 3EOF四、设置开机自启动

[root@qijing0 /]# cat > /usr/lib/systemd/system/registryd.service <<EOF[Unit]Description=private registry Documentation=https://github.com/distribution/distribution#readme[Service]ExecStart=/usr/bin/registry serve /etc/docker/registry/config.ymlUser=rootRestart=on-failureRestartSec=1500ms[Install]WantedBy=multi-user.targetEOF

  • 写入 /usr/lib/systemd/system/registryd.service 文件
[root@qijing0 workspace_registry]# systemctl restart registryd && systemctl enable registryd

  • 开机主动启动
[root@qijing0 workspace_registry]# systemctl status registryd● registryd.service - private registry   Loaded: loaded (/usr/lib/systemd/system/registryd.service; disabled; vendor preset: disabled)   Active: active (running) since Mon 2022-11-21 21:11:30 EST; 1min 39s ago     Docs: https://github.com/distribution/distribution#readme Main PID: 23538 (registry)    Tasks: 10   Memory: 12.3M   CGroup: /system.slice/registryd.service           └─23538 /usr/bin/registry serve /etc/docker/registry/config.ymlNov 21 21:11:30 qijing0 systemd[1]: Started private registry.Nov 21 21:11:30 qijing0 registry[23538]: time="2022-11-21T21:11:30.520567702-05:00" level=warning msg="No HTTP secret provided - generate...Nov 21 21:11:30 qijing0 registry[23538]: time="2022-11-21T21:11:30.520753886-05:00" level=info msg="redis not configured" go.versi...nknown"Nov 21 21:11:30 qijing0 registry[23538]: time="2022-11-21T21:11:30.52077835-05:00" level=info msg="Starting upload purge in 9m0s" ...nknown"Nov 21 21:11:30 qijing0 registry[23538]: time="2022-11-21T21:11:30.536508757-05:00" level=info msg="using inmemory blob descriptor...nknown"Nov 21 21:11:30 qijing0 registry[23538]: time="2022-11-21T21:11:30.536798348-05:00" level=info msg="listening on [::]:5000" go.ver...nknown"Hint: Some lines were ellipsized, use -l to show in full

  • 验证服务状态
五、安装用户界面

用户界面比力无所谓,自我感觉不消过细设置(究竟不关心界面的技能栈),二进制装还比力贫困。直接利用docker 启动了:
[root@qijing0 ~]# docker run -d -p 5001:80 --env REGISTRY_TITLE='QIJING Private Docker Registry' --env REGISTRY_URL=http://192.168.3.1:5000 --env SINGLE_REGISTRY=true --name docker-registry-ui joxit/docker-registry-ui:latest          bb8636f234642068b9e24ee4a92538f1639692d7739994b04ffe06768da7cbb0欣赏器访问ip地点,验证安装:

推送镜像,验证安装:
nerdctl push 192.168.3.1:5000/test-server:0.0.3 --insecure-registry

  • 可以看到,现在已经推送乐成了。
拉取镜像,验证安装:
[root@k8s1 ~]# nerdctl pull xxxxxxxxxxxxxxxxx:5000/test-server:0.0.3 --insecure-registry WARN[0000] skipping verifying HTTPS certs for "xxxxxxxxxxxxxxxxx:5000" INFO[0000] trying next host                              error="failed to do request: Head \"https://xxxxxxxxxxxxxxxxx:5000/v2/test-server/manifests/0.0.3\": http: server gave HTTP response to HTTPS client" host="xxxxxxxxxxxxxxxxx:5000"WARN[0000] server "xxxxxxxxxxxxxxxxx:5000" does not seem to support HTTPS, falling back to plain HTTP  error="failed to resolve reference \"xxxxxxxxxxxxxxxxx:5000/test-server:0.0.3\": failed to do request: Head \"https://xxxxxxxxxxxxxxxxx:5000/v2/test-server/manifests/0.0.3\": http: server gave HTTP response to HTTPS client"xxxxxxxxxxxxxxxxx:5000/test-server:0.0.3: resolving      |--------------------------------------| elapsed: 0.1 s                                      total:   0.0 B (0.0 B/s)                                         xxxxxxxxxxxxxxxxx:5000/test-server:0.0.3:                               resolved       |++++++++++++++++++++++++++++++++++++++| manifest-sha256:e0f152bb79f22dcbaaf4429cf8bc3cff75d831a5bee8042acf018560f5900586: done           |++++++++++++++++++++++++++++++++++++++| config-sha256:cf3c9b089da1f8120c9ee912752dd14d56d7ef769d81d6a81423dea7324a3e5b:   done           |++++++++++++++++++++++++++++++++++++++| layer-sha256:1ac10fb9def776a83d1c0f223a554096276d41f7f92ddb642049b8274713c863:    done           |++++++++++++++++++++++++++++++++++++++| layer-sha256:58c4eaffce77ac1fb013bf82c91927c631802ad54465ebc9b687b5dc8ee73c02:    done           |++++++++++++++++++++++++++++++++++++++| layer-sha256:d14afce733284f533ef0231bbf5eac60b0fe3ea5b536fb62f27d5ed8a66cdcbf:    done           |++++++++++++++++++++++++++++++++++++++| layer-sha256:e6a22c806ee8aa2b360bd5818a4f78bc3da280abb86f3db09805b1daddd78324:    done           |++++++++++++++++++++++++++++++++++++++| layer-sha256:961d55d95b310f4184745eb0f3dcaad3d03e8d6d477a0ecac1ef4a4b8795ad72:    done           |++++++++++++++++++++++++++++++++++++++| layer-sha256:e88a2a8ed0885e3915c290365e61db3b4b2090edf20e0c45980bf1e45d7d991f:    done           |++++++++++++++++++++++++++++++++++++++| elapsed: 16.8s                                                                    total:  580.3  (34.5 MiB/s)                                      [root@k8s1 ~]# nerdctl image ls | grep serverxxxxxxxxxxxxxxxxx:5000/test-server    0.0.3    e0f152bb79f2    2 minutes ago    linux/amd64    845.2 MiB    580.3 MiB

  • 可以看到也是没题目标。
ok,开始享受内网的超高速推送、拉取镜像
您需要登录后才可以回帖 登录 | 立即注册

Powered by CangBaoKu v1.0 小黑屋藏宝库It社区( 冀ICP备14008649号 )

GMT+8, 2024-11-24 10:10, Processed in 0.144283 second(s), 36 queries.© 2003-2025 cbk Team.

快速回复 返回顶部 返回列表