docker仓库
docker公共仓库
国内docker仓库
阿里 开发者平台
docker仓库
docker仓库是存放镜像的地方,分为共有仓库和私有仓库。
搭建docker本地私有仓库
- 使用registry镜像创建私有仓库
- docker run -d -p 5000:5000 registry
- 支持的参数:-v:指定registry镜像存放的本地位置,默认是存放到容器、temp/registry目录下
- docker run -d -p 5000:5000 -v /usr/local/docker/images/registry registry
- 以上命令,自动下载并创建registry容器,并创建私有仓库,监听端口为5000
- docker run -d -p 5000:5000 registry
- 上传镜像到私有仓库
- 将镜像命名为: ip:端口号/镜像名称。 例如:docker tag redis 127.0.0.1:5000/myredis
- docker push 127.0.0.1:5000/myredis
- 查看私有仓库的镜像
- 查看私有仓库的镜像: curl -XGET http://127.0.0.1:5000/v2/_catalog
- 获取某个镜像的标签列表: curl -XGET http://127.0.0.1:5000/v2/myredis/tags/list
- 从私有仓库下载镜像
- docker pull ip:端口号/镜像名称
[root@localhost ~]# docker run -d -p 5000:5000 registry Unable to find image 'registry:latest' locally latest: Pulling from library/registry 81033e7c1d6a: Pull complete b235084c2315: Pull complete c692f3a6894b: Pull complete ba2177f3a70e: Pull complete a8d793620947: Pull complete Digest: sha256:672d519d7fd7bbc7a448d17956ebeefe225d5eb27509d8dc5ce67ecb4a0bce54 Status: Downloaded newer image for registry:latest 1cd1bd60f83eb8d7ddd05ab5b7eac2842a993b88f8d5e344915f619ca36c65df [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE myimprt 1.0.0 1debb407c788 17 hours ago 31.5MB myredis latest 0bdd49822deb 3 weeks ago 32.6MB registry.cn-zhangjiakou.aliyuncs.com/cytong/redis latest 0bdd49822deb 3 weeks ago 32.6MB registry latest d1fd7d86a825 2 months ago 33.3MB [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1cd1bd60f83e registry "/entrypoint.sh /etc…" About a minute ago Up About a minute 0.0.0.0:5000->5000/tcp thirsty_kirch 87ae8e633e1b myredis "docker-entrypoint.s…" 17 hours ago Up 17 hours 6379/tcp kind_wright [root@localhost ~]# docker tag myredis 127.0.0.1:5000/myredis [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE myimprt 1.0.0 1debb407c788 17 hours ago 31.5MB 127.0.0.1:5000/myredis latest 0bdd49822deb 3 weeks ago 32.6MB myredis latest 0bdd49822deb 3 weeks ago 32.6MB registry.cn-zhangjiakou.aliyuncs.com/cytong/redis latest 0bdd49822deb 3 weeks ago 32.6MB registry latest d1fd7d86a825 2 months ago 33.3MB [root@localhost ~]# docker push 127.0.0.1:5000/myredis The push refers to repository [127.0.0.1:5000/myredis] 0b4e383175e3: Pushed fe632b435885: Pushed 833391bcaae3: Pushed 968231311ad9: Pushed 76dabc6d8ad2: Pushed 373a30c24545: Pushed a9148f5200b0: Pushed cdd3de0940ab: Pushed fc56279bbb33: Pushed b38367233d37: Pushed 2aebd096e0e2: Pushed latest: digest: sha256:c23c35b2f5cb5cb28135a8bc375cead3b9a1dbd9593c7d7fff263a2be4f2ba82 size: 2613 [root@localhost ~]# curl -XGET http://127.0.0.1:5000/v2/_catalog {"repositories":["myredis"]} [root@localhost ~]# curl -XGET http://127.0.0.1:5000/v2/myredis/tags/list {"name":"myredis","tags":["latest"]} [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE myimprt 1.0.0 1debb407c788 18 hours ago 31.5MB registry.cn-zhangjiakou.aliyuncs.com/cytong/redis latest 0bdd49822deb 3 weeks ago 32.6MB 127.0.0.1:5000/myredis latest 0bdd49822deb 3 weeks ago 32.6MB myredis latest 0bdd49822deb 3 weeks ago 32.6MB registry latest d1fd7d86a825 2 months ago 33.3MB [root@localhost ~]# docker rmi 127.0.0.1:5000/myredis Untagged: 127.0.0.1:5000/myredis:latest Untagged: 127.0.0.1:5000/myredis@sha256:c23c35b2f5cb5cb28135a8bc375cead3b9a1dbd9593c7d7fff263a2be4f2ba82 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE myimprt 1.0.0 1debb407c788 18 hours ago 31.5MB myredis latest 0bdd49822deb 3 weeks ago 32.6MB registry.cn-zhangjiakou.aliyuncs.com/cytong/redis latest 0bdd49822deb 3 weeks ago 32.6MB registry latest d1fd7d86a825 2 months ago 33.3MB [root@localhost ~]# curl -X GET http://localhost:5000/v2/_catalog {"repositories":["myredis"]} [root@localhost ~]# docker pull 127.0.0.1:5000/myredis Using default tag: latest latest: Pulling from myredis Digest: sha256:c23c35b2f5cb5cb28135a8bc375cead3b9a1dbd9593c7d7fff263a2be4f2ba82 Status: Downloaded newer image for 127.0.0.1:5000/myredis:latest [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE myimprt 1.0.0 1debb407c788 18 hours ago 31.5MB 127.0.0.1:5000/myredis latest 0bdd49822deb 3 weeks ago 32.6MB myredis latest 0bdd49822deb 3 weeks ago 32.6MB registry.cn-zhangjiakou.aliyuncs.com/cytong/redis latest 0bdd49822deb 3 weeks ago 32.6MB registry latest d1fd7d86a825 2 months ago 33.3MB
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
2017-06-23 mybatis一对一映射配置详解
2017-06-23 Stack编程队列