Docker Registry 简化版
Docker Registry
https://docs.docker.com/registry/
Registry是一个无状态,高度可伸缩的服务器端应用程序,允许您存储和分发Docker映像
为什么要使用Registry
- 严格控制图像存储的位置
- 完全拥有镜像和控制流水线管道
- 将图像存储和分发紧密集成到您的内部开发工作流程中
依赖
The Registry is compatible with Docker engine version 1.6.0 or higher.
启动
docker run -d -p 5000:5000 --restart=always --name local-registry registry:2
docker pull ubuntu
docker image tag ubuntu localhost:5000/myfirstimage
docker pull localhost:5000/myfirstimage
docker container stop registry && docker container rm -v registry
Configuring a registry
https://docs.docker.com/registry/configuration/
高级配置: 存储 日志 认证
高级使用配置推荐使用 阿里云镜像服务 或 Harbor
配置认证
# 1. 创建自签名证书
DOMAIN=registry.local
mkdir /opt/certs && cd /opt/certs
openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca-${DOMAIN}.key \
-x509 -subj "/CN=${DOMAIN}" -days 3650 -out ca-${DOMAIN}.crt
# 2. 启动registary
docker run -d \
--restart=always \
--name ${DOMAIN} \
-v /opt/certs:/certs \
-v /mnt/registry:/var/lib/registry \
-e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/ca-${DOMAIN}.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/ca-${DOMAIN}.key \
-p 443:443 \
registry:2.7.1
# 3. 设置登录
mkdir -p /etc/docker/certs.d/${DOMAIN}
cp /opt/certs/ca-${DOMAIN}.crt /etc/docker/certs.d/${DOMAIN}/ca.crt
# 测试
$ docker pull ubuntu:18.04
$ docker tag ubuntu:18.04 registry.local/my-ubuntu
$ docker push registry.local/my-ubuntu
$ docker pull registry.local/my-ubuntu
docker registry 私有仓库 安装配置、查询、删除
https://www.cnblogs.com/elvi/p/8384675.html
https://blog.csdn.net/lxw1844912514/article/details/111055995