gpt4 book ai didi

docker push 得到 "error parsing HTTP 405 ... POST not allowed"

转载 作者:行者123 更新时间:2023-12-02 18:39:35 28 4
gpt4 key购买 nike

我正在关注 Docker教程

https://docs.docker.com/get-started/part2/#conclusion-of-part-two

当我运行 docker push 的命令时,我收到了这个错误

[root@pecan-9 firstDocker]# docker push leeyuiwah/get-started:part2
The push refers to a repository [registry.access.redhat.com/leeyuiwah/get-started]
7a8cded9ffac: Preparing
77a209967ebf: Preparing
00d1486114fa: Preparing
24b02a08f57d: Preparing
aed9311ebf15: Preparing
17f9d9d4ce37: Waiting
18f9b4e2e1bc: Waiting
error parsing HTTP 405 response body: invalid character '<' looking
for beginning of value: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2
Final//EN\">\n<title>405 Method Not Allowed</title>\n
<h1>Method Not Allowed</h1>\n<p>
The method POST is not allowed for the requested URL.</p>\n"

我在互联网上谷歌搜索。已经有很多关于同样错误的报告
在这个论坛上,但没有答案:

https://forums.docker.com/t/docker-push-command-is-throwing-error-405-method-not-allowed/28384/4

我在防火墙后面,但是当我用 docker run hello-world 测试时,
从网上拉图片,这个命令
运行没有问题。

我使用的版本比教程略低
建议。不确定这是否是原因。
[root@pecan-9 firstDocker]# docker --version
Docker version 1.12.6, build 3a094bd/1.12.6

最佳答案

检查您的主机名(特别是如果您在 RedHat 系统上运行)

(参见 this bug report with Redhat)

我意识到通过不对 tag 和 push 命令提供参数,我实际上使用了不同的注册表( registry.access.redhat.com 而不是 hub.docker.com )。

[root@pecan-9A firstDocker]# docker push leeyuiwah/get-started:part2
The push refers to a repository
[registry.access.redhat.com/leeyuiwah/get-started]
Error: Status 404 trying to push repository leeyuiwah/get-started:
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n
<title>404 Not Found</title>\n<h1>Not Found</h1>\n
<p>The requested URL was not found on the server.</p>
<p>If you entered the URL manually please check your spelling and try again.</p>
\n"

所以现在我明确设置了注册表,但后来我得到了 Index response didn't contain any endpoints
[root@pecan-9A firstDocker]# docker-latest tag friendlyhello hub.docker.com/leeyuiwah/get-started:part2
[root@pecan-9A firstDocker]# docker-latest push hub.docker.com/leeyuiwah/get-started:part2
The push refers to a repository [hub.docker.com/leeyuiwah/get-started]
3088bc0df692: Preparing
fa9c71108753: Preparing
4cc654f2b860: Preparing
24b02a08f57d: Preparing
aed9311ebf15: Preparing
17f9d9d4ce37: Waiting
18f9b4e2e1bc: Waiting
Index response didn't contain any endpoints

版本

我也改用最新的 docker 来确定问题
不是因为版本。
[root@pecan-9A firstDocker]# docker-latest --version
Docker version 1.13.1, build 6774275/1.13.1

docker login 的虚假回复?

我注意到的另一件事是 login命令已经给出
我对 Login Succeeded 的虚假回复.这可能是一个因素吗?
[root@pecan-9A firstDocker]# docker-latest login hub.docker.com
Username (leeyuiwah): bogus (I don't think this is a valid account)
Password: (just type in some junk)
Login Succeeded

使用本地自托管注册表进行测试

(参见 Docker Doc: Run a local registry)

我可以使用本地自托管注册表进行推送。还是我
使用虚假登录

安装本地自托管注册表
[root@pecan-9A firstDocker]# docker run -d -p 5000:5000 --restart=always --name registry registry:2
Unable to find image 'registry:2' locally
Trying to pull repository registry.access.redhat.com/registry ...
Trying to pull repository docker.io/library/registry ...
2: Pulling from docker.io/library/registry
90f4dba627d6: Pull complete
b3e11d7b4f5e: Pull complete
1f032f3c8932: Pull complete
425585e7aedb: Pull complete
f45f535a83d2: Pull complete
Digest: sha256:0f8fe61fa337b8ef02217702ba979b47a7d68717d4628f31592ebff85915f3ba
37f70dbd0e4f96707d07579c8ab8577032cefa9142af0c13c2dace23adda213a

进行虚假登录
[root@pecan-9A firstDocker]# docker-latest login localhost:5000
Username: dkfjld (bogus account name)
Password: (bogus password)
Login Succeeded (this still bugs me!)

标记然后推送 ==> 这次成功了!
[root@pecan-9A firstDocker]# docker-latest  tag friendlyhello localhost:5000/leeyuiwah/get-started:part2
[root@pecan-9A firstDocker]# docker-latest push localhost:5000/leeyuiwah/get-started:part2
The push refers to a repository [localhost:5000/leeyuiwah/get-started]
3088bc0df692: Pushed
fa9c71108753: Pushed
4cc654f2b860: Pushed
24b02a08f57d: Pushed
aed9311ebf15: Pushed
17f9d9d4ce37: Pushed
18f9b4e2e1bc: Pushed
part2: digest: sha256:23c9720ee308ab6fa6ec8b0c23c40fadc7562fe34352d64b2322f43a90dfec0b size: 1787

关于docker push 得到 "error parsing HTTP 405 ... POST not allowed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46574214/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com