docker pull 镜像仓库_Docker镜像仓库入门到实践

8123c5102a4bc4789bbc0b6e3d0e8c66.png

1、下载Registry镜像

docker pull registry:lastest

2、启动镜像仓库

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

3、查看镜像仓库的镜像

curl http://镜像仓库IP地址:5000/v2/_catalog

当第一次启动还没有上传镜像到镜像仓库时返回的是空的json

{"repositories":[]}

4、标记镜像

docker tag eladmin-system 镜像仓库地址/eladmin-system:test

5、上传镜像仓库

docker push 镜像仓库IP地址:5000/eladmin-system:test

上传结果
[root@VM-0-12-centos ~]# docker push 127.0.0.1:5000/eladmin-system:test
The push refers to a repository [镜像仓库IP地址/eladmin-system]
125282fb2669: Pushed
a70736c90206: Pushed
35c20f26d188: Pushed
c3fe59dd9556: Pushed
6ed1a81ba5b6: Pushed
a3483ce177ce: Pushed
ce6c8756685b: Pushed
30339f20ced0: Pushed
0eb22bfb707d: Pushed
a2ae92ffcd29: Pushed
test: digest: sha256:9656f00c3baf2231d4e065f21e733cb637c78d297e47d1361a93c1449ef21eb1 size: 2424

6、查看上传镜像

curl 镜像仓库IP地址/v2/_catalog

上传结果:
{"repositories":["eladmin-system"]}

7、下载上传的镜像

docker pull http://镜像仓库IP地址:5000/eladmin-system:test

如果私有仓库没有配置https,下载镜像时会出现如下错误:

Error response from daemon: Get https://镜像仓库IP地址:5000/v1/_ping: http: server gave HTTP response to HTTPS client

遇到以上问题,进行如下操作

  • 创建dameno.json文件并写入如下内容
echo '{ "insecure-registries":["镜像仓库IP地址:5000"] }' > /etc/docker/daemon.json

注意:如果该文件存在,直接修改该文件内容即可
{ 
    "insecure-registries" : [ "your-server-ip:5000" ] 
}
  • 重启docker
systemctl restart docker
  • 重新下载
docker pull 镜像仓库IP地址:5000/eladmin-system:test

下载成功结果
test: Pulling from eladmin-system
Digest: sha256:9656f00c3baf2231d4e065f21e733cb637c78d297e47d1361a93c1449ef21eb1
Status: Downloaded newer image for 镜像仓库地址:5000/eladmin-system:test
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值