安装Docker

yum install docker -y

配置阿里镜像加速网址

sudo tee /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"],
"insecure-registries": ["192.168.1.9:5000"]
}
EOF # xxx是自己阿里厂库的私有地址

启动Docker

systemctl start docker
systemctl enable docker

使用register搭建docker私有仓库

docker pull registry:latest
docker run -d -v /registry:/var/lib/registry -p : --restart=always --privileged=true --name registry registry:latest

测试是否搭建成功

网址:http://192.168.1.9:5000/v2/
查看厂库中的镜像:http://192.168.1.9:5000/v2/_catalog

上传一个镜像到仓库

docker pull busybox
docker tag busybox 192.168.1.9:/busybox:latest
docker push 192.168.1.9:/busybox:latest
05-28 12:11