Docker仓库(转载)
Docker仓库
Docker Registry 分类
Registry用于保存docker镜像,包括镜像的层次结构和元数据
用户可自建Registry,也可使用官方的Docker Hub
分类:
Sponsor Registry:第三方的registry,供客户和Docker社区使用
Mirror Registry:第三方的registry,只让客户使用 (第三方加速器)
Vendor Registry:由发布Docker镜像的供应商提供的registry
Private Registry:通过设有防火墙和额外的安全层的私有实体提供的registry
docker-distribution
docker 自带私有仓库服务
- 安装
# yum install docker-registry
# rpm -ql docker-registry
# systemctl start docker-distribution
# systemctl status docker-distribution
● docker-distribution.service - v2 Registry server for Docker
Loaded: loaded (/usr/lib/systemd/system/docker-distribution.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-04-28 06:41:13 UTC; 4s ago
Main PID: 23491 (registry)
Tasks: 6
Memory: 4.0M
CGroup: /system.slice/docker-distribution.service
└─23491 /usr/bin/registry serve /etc/docker-distribution/registry/config.yml
Apr 28 06:41:13 evescn systemd[1]: Started v2 Registry server for Docker.
Apr 28 06:41:13 evescn registry[23491]: time="2020-04-28T06:41:13Z" level=warning msg="No HTTP secret provided - generated...
Apr 28 06:41:13 evescn registry[23491]: time="2020-04-28T06:41:13Z" level=info msg="redis not configured" go.version...known"
Apr 28 06:41:13 evescn registry[23491]: time="2020-04-28T06:41:13Z" level=info msg="Starting upload purge in 5m0s" g...known"
Apr 28 06:41:13 evescn registry[23491]: time="2020-04-28T06:41:13Z" level=info msg="using inmemory blob descriptor c...known"
Apr 28 06:41:13 evescn registry[23491]: time="2020-04-28T06:41:13Z" level=info msg="listening on [::]:5000" go.versi...known"
Hint: Some lines were ellipsized, use -l to show in full.
- 推送镜像
# docker tag a187dde48cd2 registry.evescn.com:5000/evescn:v1
# docker push registry.evescn.com:5000/evescn:v1
The push refers to repository [registry.evescn.com:5000/evescn]
Get https://registry.evescn.com:5000/v2/: http: server gave HTTP response to HTTPS client
- 配置容器支持http协议
# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://72idtxd8.mirror.aliyuncs.com"],
"insecure-registries": ["registry.evescn.com:5000"]
}
- 重新推送
# docker push registry.evescn.com:5000/evescn:v1
The push refers to repository [registry.evescn.com:5000/evescn]
bab68e5155b7: Pushed
60ef3ee42de7: Pushed
367024e4e006: Pushed
c03c7e9701eb: Pushed
b5a8df342567: Pushed
b60e5c3bcef2: Pushed
v1: digest: sha256:a5aae2581826d13e906ff5c961d4c2817a9b96c334fd97b072d976990384156a size: 1572
harbor
- 安装文档