docker镜像仓库

匿名 (未验证) 提交于 2019-12-02 23:43:01

Docker Hub作为Docker默认官方公共镜像,如果想自己搭建私有镜像仓库,官方也提供registry镜像,使得搭建私有仓库非常简单。
下载registry镜像并启动

[root@docker ~]# docker pull registry [root@docker ~]# docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry 790e35569960041b5976786ab76babc8213e81e0a2d3b1bf3a9c0b5cc2bd1280

测试查看镜像仓库中所有镜像

[root@docker ~]# curl http://192.168.193.128:5000/v2/_catalog {"repositories":[]}

配置私有仓库可信任

[root@docker ~]# cat /etc/docker/daemon.json  {     "registry-mirrors":["https://registry.docker-cn.com"],     "insecure-registries":["192.168.193.128:5000"] } [root@docker ~]# systemctl restart docker

打标签

[root@docker ~]# docker tag nginx:1.12 192.168.193.128:5000/nginx:1.12

上传

[root@docker ~]# docker push 192.168.193.128:5000/nginx:1.12 [root@docker ~]# curl http://192.168.193.128:5000/v2/_catalog {"repositories":["nginx"]} 查看信息 [root@docker ~]# curl http://192.168.193.128:5000/v2/nginx/tags/list {"name":"nginx","tags":["1.12"]}

下载

[root@docker ~]# docker run -itd --name nginx -p 80:80 192.168.193.128:5000/nginx:1.12 6c13f1122f713237e44aabe58f345652785d21f4b2a1deda05985bbf03b5a1be

企业通常使用Docker Harbor镜像管理工具。

注册账号
https://hub.docker.com/
登录Docker Hub
创建仓库

linux端登录

[root@docker ~]# docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: yinshoucheng Password:  WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store  Login Succeeded 或 [root@docker ~]# docker login --username=yinshoucheng --password=123456

镜像打标签

[root@docker ~]# docker tag nginx:1.12 yinshoucheng/golden:1.12

上传

[root@docker ~]# docker push yinshoucheng/golden:1.12

搜索测试

[root@docker ~]# docker search yinshoucheng NAME                  DESCRIPTION         STARS               OFFICIAL            AUTOMATED yinshoucheng/golden                       0                    

下载

[root@docker ~]# docker pull yinshoucheng/golden:1.12
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!