Docker push镜像失败解决方法
Dockerpush镜像失败的问题。
以下是输入push自己的tomcat后出现了失败
[root@slave3~]#dockerpushlekkoliu/tomcat8:latest Thepushreferstoarepository[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:authenticationrequired
以下是已经执行过的方案:将privatehub改变为public,不能解决这个问题。
解决方案:
这里尤其注意,如果命名方式不对,是不行的。
以我自己的为例:
我docker官方中申请的hub为:
PRIVATEREPOSITORY lekko/liu
这里在执行本地dockerpush的时候,要先利用dockertag的命令来修改image为符合规范(dockertagusername/userimage)的命名。
例如:
[root@slave3~]#dockertaglekko/liu/tomcat8lekko/tomcat8
之前我以为username是我整个的名字即lekko/liu。后来我经过多次测试,测出原来这里的username指的是申请的账号,即我的lekko/liu中的lekko。
此时,如上面代码所示,修改后的image名称为lekko/tomcat8。
因此这里把这个imagepush出去即可。
[root@slave3~]#dockerpushlekko/tomcat8 Thepushreferstoarepository[docker.io/lekko/tomcat8] cefee3f6c961:Layeralreadyexists 82f021d9c2b9:Layeralreadyexists 4f91f02b4e49:Layeralreadyexists a4b3ce7e1d4a:Layeralreadyexists c3b95f8496f1:Layeralreadyexists bcfb53b3ff7c:Layeralreadyexists 3aa267e87e63:Layeralreadyexists 6c0ce72ad569:Layeralreadyexists 3242004f198a:Layeralreadyexists b2ac5371e0f2:Layeralreadyexists 142a601d9793:Layeralreadyexists latest:digest:sha256:4c878796e09584128e4eb3a17c9d6cb66c33e3678db377aa1921110116e2b4dasize:2625
此时,可以通过docker服务器来来取到刚才上传好的镜像:
[root@master~]#dockerpulllekko/tomcat8 Usingdefaulttag:latest latest:Pullingfromlekko/tomcat8 6a5a5368e0c2:Pullcomplete 7b9457ec39de:Pullcomplete d5cc639e6fca:Pullcomplete dae3b0638638:Pullcomplete ab678d1c6f00:Pullcomplete d5bf826c3153:Pullcomplete 0081bad1df81:Pullcomplete 8fafa3f26de4:Pullcomplete ae984359ed7e:Pullcomplete 9175a2e1674f:Pullcomplete 2e8f15e74426:Pullcomplete Digest:sha256:4c878796e09584128e4eb3a17c9d6cb66c33e3678db377aa1921110116e2b4da Status:Downloadednewerimageforlekko/tomcat8:latest
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!