一、docker registry分类
二、安装docker-hub提供的registry
1、安装
[root@localhost yum.repos.d]# yum install -y docker-registry [root@localhost yum.repos.d]# rpm -ql docker-distribution
/etc/docker-distribution/registry/config.yml
/usr/bin/registry
/usr/lib/systemd/system/docker-distribution.service
/usr/share/doc/docker-distribution-2.6.
/usr/share/doc/docker-distribution-2.6./AUTHORS
/usr/share/doc/docker-distribution-2.6./CONTRIBUTING.md
/usr/share/doc/docker-distribution-2.6./LICENSE
/usr/share/doc/docker-distribution-2.6./MAINTAINERS
/usr/share/doc/docker-distribution-2.6./README.md
/var/lib/registry [root@localhost yum.repos.d]# cat /etc/docker-distribution/registry/config.yml
version: 0.1
log:
fields:
service: registry
storage:
cache:
layerinfo: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: : [root@localhost /]# netstat -anpt|grep
tcp6 ::: :::* LISTEN /registry
2、安装后客户端要push镜像默认是需要https的,但是此仓库默认为http协议,因此需要在客户端 /etc/docker/daemon.json 文件下将需要连接的http仓库地址以非安全形式添加进去
[root@localhost /]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://guxaj7v7.mirror.aliyuncs.com"],
"insecure-registries": ["www.wohaoshuai.com:5000"]
} [root@localhost /]# docker tag wohaoshuaihttpd:v0.- www.wohaoshuai.com:/wohaoshuaihttpd:v0.- [root@localhost /]# systemctl restart docker
[root@localhost /]# docker push www.wohaoshuai.com:/wohaoshuaihttpd:v0.-
The push refers to repository [www.wohaoshuai.com:/wohaoshuaihttpd]
d08a986474c1: Pushed
0b97b1c81a32: Pushed
v0.-: digest: sha256:49d22819c6014a0e1c5ffb8982a0e45a24d1cf6fb300310269d9f3d68081bcfb size:
[root@localhost registry]# pwd
/var/lib/registry/docker/registry
[root@localhost registry]# tree
.
└── v2
├── blobs
│?? └── sha256
│?? ├──
│?? │?? └── 087c55a4372d53b3413898cde2fb45a6e7949cd876d2d4a0bef3e89d2ddb2783
│?? │?? └── data
│?? ├──
│?? │?? └── 49d22819c6014a0e1c5ffb8982a0e45a24d1cf6fb300310269d9f3d68081bcfb
│?? │?? └── data
│?? ├──
│?? │?? └── 87261e2e0944a05c77878c1214d2a14a0e62ec63fc90db014ef23af1380c5083
│?? │?? └── data
│?? └── fc
│?? └── fc1a6b909f82ce4b72204198d49de3aaf757b3ab2bb823cb6e47c416b97c5985
│?? └── data
└── repositories
└── wohaoshuaihttpd
├── _layers
│?? └── sha256
│?? ├── 087c55a4372d53b3413898cde2fb45a6e7949cd876d2d4a0bef3e89d2ddb2783
│?? │?? └── link
│?? ├── 87261e2e0944a05c77878c1214d2a14a0e62ec63fc90db014ef23af1380c5083
│?? │?? └── link
│?? └── fc1a6b909f82ce4b72204198d49de3aaf757b3ab2bb823cb6e47c416b97c5985
│?? └── link
├── _manifests
│?? ├── revisions
│?? │?? └── sha256
│?? │?? └── 49d22819c6014a0e1c5ffb8982a0e45a24d1cf6fb300310269d9f3d68081bcfb
│?? │?? └── link
│?? └── tags
│?? └── v0.-
│?? ├── current
│?? │?? └── link
│?? └── index
│?? └── sha256
│?? └── 49d22819c6014a0e1c5ffb8982a0e45a24d1cf6fb300310269d9f3d68081bcfb
│?? └── link
└── _uploads
三、安装Harbor
1、docker compose
48分49