一、下载registry
略
docker load -i registry.tar.gz
二、启动私有容器
docker run -d -p 5000:5000 --restart=always --name registry -v /opt/myregistry:/var/lib/registry registry:latest
三、打标签
docker tag alpine:latest 10.0.0.11:5000/alpine:latest
四、上传镜像
docker push 10.0.0.11:5000/alpine:latest
五、上传报错解决
报错;
The push refers to a repository [10.0.0.11:5000/centos:6.10]
Get https://10.0.0.11:5000/v1/_ping: http: server gave HTTP response to HTTPS client
解决:
把自己的私有镜像仓库加到信任的仓库列表中。
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"insecure-registries": ["10.0.0.11:5000"]
}
注意一行结尾的逗号
重启docker systemctl restart docker
然后重新push
网友评论