docker 私有仓库

可以通过获取官方registry镜像来运行。默认情况下,仓库会被创建在容器的/var/lib/registry目录下。可以通过-v参数来将镜像文件存放在本地的指定路径。

docker run --name registry -d  -p 5000:5000 --restart=always  -v /opt/data/registry:/var/lib/registry registry

  

使用docker push上传镜像

docker push 172.19.25.169:5000/docker-hello-world:latest

 

 报错 修改环境后再 push

echo '{ "insecure-registries":["172.19.25.169:5000"] }' > /etc/docker/daemon.json
systemctl restart docker

 

用curl查看仓库中的镜像

curl 172.19.25.169:5000/v2/_catlog

 

先删除已有镜像,再尝试从私有仓库中下载这个镜像

docker image rm 172.19.25.169:5000/docker-hello-world:latest
docker images
docker pull 172.19.25.169:5000/docker-hello-world:latest
docker images

 

 

 

 

仓库文章:

https://zhuanlan.zhihu.com/p/78543733

 

posted @ 2021-11-18 10:45  草木物语  阅读(31)  评论(0编辑  收藏  举报