docker 系列6 上传镜像

一.介绍

  本节主要介绍Docker镜像的push子命令,可以使用 docker [image] push命令上传镜像到仓库,默认上传到Docker hub官方仓库(需要登录)。命令格式 为docker [image] push NAME[:TAG]  | [REGISTRY_HOST[:REGISTRY_PORT]/] NAME[:TAG]。

  用户在docker hub网站注册后可以上传自制的镜像。

  文档:https://docs.docker.com/engine/reference/commandline/push/

  例如我的docker hub 的用户名为:hushaoren,先登录

复制代码
[root@VM_0_12_centos ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: hushaoren
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
复制代码

  将原有的镜像hello-world上传到仓库,先传前需要使用docker tag 将要发布的镜像改到自己账户名下。创建后再查看如下所示:

[root@VM_0_12_centos ~]# docker tag hello-world hushaoren/hello-world
[root@VM_0_12_centos ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
hushaoren/hello-world   latest              bf756fb1ae65        3 months ago        13.3kB
hello-world             latest              bf756fb1ae65        3 months ago        13.3kB
hello-world             latest              bf756fb1ae65        3 months ago        13.3kB

  上传镜像成功

[root@VM_0_12_centos ~]# docker push  hushaoren/hello-world
The push refers to repository [docker.io/hushaoren/hello-world]
9c27e219663c: Mounted from library/hello-world 
latest: digest: sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 size: 525

  去docker hub官方网站查看

  

   如果要获取镜像,查看docker 系列3 

 

  

  

posted on   花阴偷移  阅读(12)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下

导航

点击右上角即可分享
微信分享提示