docker tag 和 docker push

docker tag 详解

docker tag 命令的使用,以及如何将本地的镜像推送到daocloud.io,这里不用docker hub作实验,是因为,docker hub网速不给力,容易推送失败。

使用docker tag使用镜像ID重命名

chenyangdeMacBook-Pro:~ chenyang$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
chenyangdeMacBook-Pro:~ chenyang$ 
chenyangdeMacBook-Pro:~ chenyang$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
chenyangdeMacBook-Pro:~ chenyang$ docker tag fce289e99 hello-world:v1
chenyangdeMacBook-Pro:~ chenyang$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v1                  fce289e99eb9        9 weeks ago         1.84 kB

使用docker tag使用镜像tag重命名

chenyangdeMacBook-Pro:~ chenyang$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v1                  fce289e99eb9        9 weeks ago         1.84 kB
chenyangdeMacBook-Pro:~ chenyang$ docker tag hello-world:latest hello-world:v2
chenyangdeMacBook-Pro:~ chenyang$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v1                  fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v2                  fce289e99eb9        9 weeks ago         1.84 kB

使用docker push 推送镜像到daocloud.io

  1. 需要登陆daocloud.io,如果没有账户的,需要去网站上注册一个。
chenyangdeMacBook-Pro:~ chenyang$ docker login daocloud.io
Username (chenyang_1010): chenyang_1010
Password: 
Login Succeeded
chenyangdeMacBook-Pro:~ chenyang$ 
  1. 打上标签,然后上传
chenyangdeMacBook-Pro:~ chenyang$ docker tag hello-world daocloud.io/zter/hello-world:v1
chenyangdeMacBook-Pro:~ chenyang$ docker images
REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
hello-world                    latest              fce289e99eb9        9 weeks ago         1.84 kB
hello-world                    v1                  fce289e99eb9        9 weeks ago         1.84 kB
hello-world                    v2                  fce289e99eb9        9 weeks ago         1.84 kB
daocloud.io/zter/hello-world   v1                  fce289e99eb9        9 weeks ago         1.84 kB
chenyangdeMacBook-Pro:~ chenyang$ docker push daocloud.io/zter/hello-world:v1
The push refers to a repository [daocloud.io/zter/hello-world]
af0b15c8625b: Pushed 
v1: digest: sha256:39bbd4a41b5d3b164632d3b4a295c0db31139992a8fe985f949dac7ccff7aa54 size: 524
  1. 上传结果
    镜像上传到daocloud.io
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值