欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

docker tag和docker push的使用详解

程序员文章站 2022-03-18 13:27:55
docker tag 详解 docker tag 命令的使用,以及如何将本地的镜像推送到daocloud.io,这里不用docker hub作实验,是因为,docker...

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

需要登陆daocloud.io,如果没有账户的,需要去网站上注册一个。

chenyangdemacbook-pro:~ chenyang$ docker login daocloud.io
username (chenyang_1010): chenyang_1010
password: 
login succeeded
chenyangdemacbook-pro:~ chenyang$ 

打上标签,然后上传

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

上传结果

docker tag和docker push的使用详解

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。