以下是输入push自己的tomcat后出现了失败
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@slave3 ~] # docker push lekkoliu/tomcat8:latest The push refers to a repository [docker.io /lekkoliu/tomcat8 ] cefee3f6c961: Preparing 82f021d9c2b9: Preparing 4f91f02b4e49: Preparing a4b3ce7e1d4a: Preparing c3b95f8496f1: Preparing bcfb53b3ff7c: Waiting 3aa267e87e63: Waiting 6c0ce72ad569: Waiting 3242004f198a: Waiting b2ac5371e0f2: Waiting 142a601d9793: Waiting unauthorized: authentication required |
以下是已经执行过的方案:将private hub改变为 public,不能解决这个问题。
解决方案:
这里尤其注意,如果命名方式不对,是不行的。
以我自己的为例:
我docker官方中申请的hub为:
1
2
|
PRIVATE REPOSITORY lekko /liu |
这里在执行本地docker push的时候,要先利用docker tag的命令来修改image为符合规范(docker tag username/userimage)的命名。
例如:
1
|
[root@slave3 ~] # docker tag lekko/liu/tomcat8 lekko/tomcat8 |
之前我以为username是我整个的名字即lekko/liu。后来我经过多次测试,测出原来这里的username指的是申请的账号,即我的lekko/liu中的lekko。
此时,如上面代码所示,修改后的image名称为lekko/tomcat8。
因此这里把这个image push出去即可。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@slave3 ~] # docker push lekko/tomcat8 The push refers to a repository [docker.io /lekko/tomcat8 ] cefee3f6c961: Layer already exists 82f021d9c2b9: Layer already exists 4f91f02b4e49: Layer already exists a4b3ce7e1d4a: Layer already exists c3b95f8496f1: Layer already exists bcfb53b3ff7c: Layer already exists 3aa267e87e63: Layer already exists 6c0ce72ad569: Layer already exists 3242004f198a: Layer already exists b2ac5371e0f2: Layer already exists 142a601d9793: Layer already exists latest: digest: sha256:4c878796e09584128e4eb3a17c9d6cb66c33e3678db377aa1921110116e2b4da size: 2625 |
此时,可以通过docker 服务器来来取到刚才上传好的镜像:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@master ~] # docker pull lekko/tomcat8 Using default tag: latest latest: Pulling from lekko /tomcat8 6a5a5368e0c2: Pull complete 7b9457ec39de: Pull complete d5cc639e6fca: Pull complete dae3b0638638: Pull complete ab678d1c6f00: Pull complete d5bf826c3153: Pull complete 0081bad1df81: Pull complete 8fafa3f26de4: Pull complete ae984359ed7e: Pull complete 9175a2e1674f: Pull complete 2e8f15e74426: Pull complete Digest: sha256:4c878796e09584128e4eb3a17c9d6cb66c33e3678db377aa1921110116e2b4da Status: Downloaded newer image for lekko /tomcat8 :latest |
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
原文链接:http://blog.csdn.net/lsttoy/article/details/53114750