- 创建docker镜像仓库
- 修改镜像tag
- 上传镜像
- 登录dockerhub
- push自定义镜像到dockerhub
- 下载自己上传的镜像
先登录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



