栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

在dockerhub上创建自己的镜像仓库

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在dockerhub上创建自己的镜像仓库

在dockerhub上创建自己的镜像仓库
    • 创建docker镜像仓库
        • 修改镜像tag
    • 上传镜像
      • 登录dockerhub
      • push自定义镜像到dockerhub
    • 下载自己上传的镜像

创建docker镜像仓库

先登录https://www.docker.com/

点击repositories创建存储库

再点击右上角的Create Repository

输入仓库名和仓库描述,选择公开仓库或私有仓库.


修改镜像tag
# 查看本地镜像
[rhel8 root ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
hello-world   latest    feb5d9fea6a5   5 weeks ago   13.3kB

# 修改镜像
## docker tag 镜像名称:标签 新的镜像名称(要和你dockerhub上的一致):新的标签	
[rhel8 root ~]# docker tag hello-world:latest omaidb/omaidb:test

# 查看镜像
[rhel8 root ~]# docker images
REPOSITORY      TAG       IMAGE ID       CREATED       SIZE
omaidb/omaidb   test      feb5d9fea6a5   5 weeks ago   13.3kB
hello-world     latest    feb5d9fea6a5   5 weeks ago   13.3kB

上传镜像
登录dockerhub
# 登录dockerhub
docker login

# 按照提示输入用户名和密码

# 注意:认证文件将存放在 /root/.docker/config.json文件中
push自定义镜像到dockerhub
[rhel8 root ~]# docker push omaidb/omaidb:test
The push refers to repository [docker.io/omaidb/omaidb]
e07ee1baac5f: Mounted from library/hello-world
test: digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4 size: 525

# dockerhub检测到镜像是一致的,所以直接从library/hello-world上导入了

上传成功

下载自己上传的镜像
# 删除本地的镜像
[rhel8 root ~]# docker rmi omaidb/omaidb:test
Untagged: omaidb/omaidb:test
Untagged: omaidb/omaidb@sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4

# 下载刚才下载的镜像
[rhel8 root ~]# docker pull omaidb/omaidb:test
test: Pulling from omaidb/omaidb
Digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4
Status: Downloaded newer image for omaidb/omaidb:test
docker.io/omaidb/omaidb:test

# 查看下载的镜像
[rhel8 root ~]# docker images
REPOSITORY      TAG       IMAGE ID       CREATED       SIZE
hello-world     latest    feb5d9fea6a5   5 weeks ago   13.3kB
omaidb/omaidb   test      feb5d9fea6a5   5 weeks ago   13.3kB
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/388780.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号