docker 系列6 上传镜像

一.介绍

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

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

  文档:docker push | Docker Docs

  例如我的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 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值