DockerHub 镜像仓库(5)

 


之前我们使用的镜像都是从 DockerHub 公共仓库拉取的,我们也学习了如何制作自己的镜像,但是通过 tar 包的方式实现镜像的备份恢复迁移对于团队协作开发并不是特别友好,我们也可以将镜像推送至 DockerHub 仓库方便使用。
温馨提示:如果构建的镜像内携带了项目数据,建议还是使用私有仓库比较好。

1. 注册账号

官网:https://hub.docker.com/

2. shell 命令登入

通过 docker login 命令输入账号密码登录 DockerHub。

3. 推送镜像至仓库

为了方便测试,我们将 hello-world 镜像拉取至本地,然后再上传至 DockerHub 仓库中。
先给镜像设置标签 docker tag local-image:tagname new-repo:tagname ;
再将镜像推送至仓库 docker push new-repo:tagname 。

docker tag hello-world:latest xxxx/test-hello-world:1.0.0
docker push xxxx/test-hello-world:1.0.0

4. 拉取镜像

通过 docker pull xxxx/test-hello-world:1.0.0 测试镜像是否可以拉取。

5. 退出账号

通过 docker logout 命令退出 DockerHub。

[root@localhost ~]# docker logout
Removing login credentials for https://index.docker.io/v1/
posted @   shenghuotaiai  阅读(95)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示