这篇文章主要介绍“docker tag和docker push如何使用”,在日常操作中,相信很多人在docker tag和docker push如何使用问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”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
需要登陆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如何使用”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注编程之家网站,小编会继续努力为大家带来更多实用的文章!