服务器之家:专注于服务器技术及软件下载分享
分类导航

云服务器|WEB服务器|FTP服务器|邮件服务器|虚拟主机|服务器安全|DNS服务器|服务器知识|Nginx|IIS|Tomcat|

服务器之家 - 服务器技术 - 服务器知识 - docker tag和docker push的使用详解

docker tag和docker push的使用详解

2021-04-01 19:25chenyang1010 服务器知识

这篇文章主要介绍了docker tag和docker push的使用详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

docker tag 详解

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

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

?
1
2
3
4
chenyangdeMacBook-Pro:~ chenyang$ docker images
REPOSITORY     TAG         IMAGE ID      CREATED       SIZE
hello-world     latest       fce289e99eb9    9 weeks ago     1.84 kB
chenyangdeMacBook-Pro:~ chenyang$
?
1
2
3
4
5
6
7
8
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重命名

?
1
2
3
4
5
6
7
8
9
10
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,如果没有账户的,需要去网站上注册一个。

?
1
2
3
4
5
chenyangdeMacBook-Pro:~ chenyang$ docker login daocloud.io
Username (chenyang_1010): chenyang_1010
Password:
Login Succeeded
chenyangdeMacBook-Pro:~ chenyang$

打上标签,然后上传

?
1
2
3
4
5
6
7
8
9
10
11
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的使用详解

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

原文链接:https://blog.csdn.net/chenyang1010/article/details/88324034

延伸 · 阅读

精彩推荐