在Dockerhub上下载,上传并标注自己的image


首先注册Dockerhub,创建repository

Username:daisyhxj

Passwd :


步骤一:tag and push the image,可以在本地看到标注自己的hello-world  image

root@ubuntu-daisy:~# docker images

REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE

hello-world                latest             c54a2cc56cbb        10 weeksago        1.848 kB

 

root@ubuntu-daisy:~# docker tag  c54a2cc56cbb  daisyhxj/hello-world:latest

root@ubuntu-daisy:~# docker images

REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE

daisyhxj/hello-world       latest             c54a2cc56cbb        10 weeksago        1.848 kB

hello-world                latest             c54a2cc56cbb        10 weeksago        1.848 kB

   docker tag命令格式


   1.  Tells your operating system you are using the docker program

    2.A subcommand that tags an image

    3.The image ID 

    4.Your account name from Docker Hub / The image name : Version label or tag


     1.docker           2.tag            3. c54a2cc56cbb         4. daisyhxj/hello-world:latest

                                    


步骤二: 在本地login  Dockerhub

root@ubuntu-daisy:~# 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.comto create one.

Username : daisyhxj

Password:

Login Succeeded


步骤三: push image 到Dockerhub repository

root@ubuntu-daisy:~# docker  push  daisyhxj/hello-world

The push refers to a repository[docker.io/daisyhxj/hello-world]

a02596fdd012: Mounted from library/hello-world

latest: digest: sha256:a18ed77532f6d6781500db650194e0f9396ba5f05f8b50d4046b294ae5f83aa4size: 524

现在可以登录网上Dockerhub 查看repository ,添加了daisyhxj/hello-world这个仓库


步骤四:pull image from Dockerhub

首先删除本地的hello-world image 及daisyhxj/hello-world image , 若要执行它,可以从hub上download

root@ubuntu-daisy:~# docker stop $(docker ps -a -q)

root@ubuntu-daisy:~# docker rmi -f  c54a2cc56cbb

root@ubuntu-daisy:~# docker images

REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE

 

root@ubuntu-daisy:~# docker run daisyhxj/hello-world

Unable to find image 'daisyhxj/hello-world:latest' locally

latest: Pulling from daisyhxj/hello-world

c04b14da8d14: Pull complete

Digest:sha256:a18ed77532f6d6781500db650194e0f9396ba5f05f8b50d4046b294ae5f83aa4

Status: Downloaded newer image for daisyhxj/hello-world:latest

 

Hello from Docker!

This message shows that your installation appears to beworking correctly.

成功从hub上下载下来并执行








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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值