上传、下载镜像:dockerhub和gitlab
打标签注意,tag默认是latest。若不是,则需要标明tag。
DockerHub上传和下载docker镜像
1.先申请一个自己的DockerHub账户。
2.dckerhub上传下载镜像
①.登录 docker login -u dockerhub账号ID (docker login 默认登录的dockerhub)
②.给镜像打标签,标签规则(github_ID/仓库名:tagname)
[root@localhost gaokai]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE redis alpine 3900abf41552 3 weeks ago 32.4MB python 3.7-alpine a1034fd13493 3 weeks ago 41.8MB centos latest 5d0da3dc9764 3 months ago 231MB
#docker tag REPOSITORY:TAG github账号/仓库名:标签(TAG)
#docker tag centos 3240421650/test:centos01
结果(标题对应如上)
REPOSITORY TAG IMAGE ID CREATED SIZE
3240421650/test centos01 5d0da3dc9764 3 months ago 231MB
③.推送镜像
1 2 | #docker push REPOSITORY:TAG (REPOSITORY要是"账号/仓库名") #docker push 3240421650/test:centos01 |
如图
然后登录dockerhub查看
DockerHub参考文章链接:https://cloud.tencent.com/developer/article/1549825
Gitlab上传、下载docker镜像
gitlab上传下载镜像
1.登录
gitlab和dockerhub不同,它需要指定gitlab的使用用户、和对应的ip地址及仓库开通的端口 #docker login -u root 192.168.24.136:4567 (gitlab需要指定地址和端口)
2.给镜像打标签,标签规则(镜像仓库地址/仓库名/tagname)
#docker tag REPOSITORY:TAG 镜像仓库地址/用户名/仓库名/tagname
如:
# docker tag centos:laster 192.168.24.136:4567/root/ceshi/centos01
如下:
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis alpine 3900abf41552 3 weeks ago 32.4MB
python 3.7-alpine a1034fd13493 3 weeks ago 41.8MB
centos latest 5d0da3dc9764 3 months ago 231MB
192.168.24.136:4567/root/ceshi/centos01 latest 5d0da3dc9764 3 months ago 231MB
3.gitlab上传镜像:
#docker push 192.168.24.136:4567/root/ceshi/centos01:latest
4.gitlab下载镜像
#docker pull 192.168.24.136:4567/root/ceshi/centos01 注意:如果写出"# docker tag python:3.7-alpine 192.168.24.136:4567/root/ceshi:python01", 则会成这种结果 192.168.24.136:4567/root/ceshi python01 a1034fd13493 3 weeks ago 41.8MB 同时,上传gitlab后,名称为root/ceshi/根镜像 使用不同的镜像名称 GitLab 最多支持3个级别的镜像命名。以下镜像名称示例对当前项目有效: 192.168.24.134:4567/muyu/ceshi:tag 192.168.24.134:4567/muyu/ceshi/optional-image-name:tag 192.168.24.134:4567/muyu/ceshi/optional-name/optional-image-name:tag
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?