0

我正在写,因为我遇到了一个似乎没有得到解决的问题,我会重视社区的帮助。

我正在尝试将图像推送到我在端口 5000 上部署的本地注册表。

当我使用此命令docker push localhost:5000/explorecalifornia.com将图像推送到本地注册表时,我收到以下消息

Get "http://localhost:5000/v2/": net/http: request canceled (Client.Timeout exceeded while awaiting headers)

我已通过在邮递员上使用 GET 确认注册表位于端口 5000 上,并且我得到了有效的预期{}响应(因为我的本地注册表上目前没有图像)。

我已经尝试通过更新我的文件以根据这篇文章的etc/hosts建议注释掉“::1 localhost”来解决这个问题。这是我文件的内容etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
# ::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

etc/resolve.conf根据这篇文章的建议,我还使用以下名称服务器更新了我的文件。

nameserver 10.0.2.3
nameserver 8.8.8.8
nameserver 8.8.4.4

这些都不起作用。有没有人也遇到过这个问题?有什么建议可以帮助解决这个问题吗?

如果有帮助,这里是源代码!先感谢您 :)

4

3 回答 3

0

您可能定义了 HTTP 代理。请尝试运行这些命令。

unset http_proxy
unset https_proxy
于 2021-12-01T22:12:28.747 回答
0

我对此错误使用了解决方法,如下所示:

首先,使用 localhost ip 标记图像,即

docker tag imagename 127.0.0.1:5000/imagename

和,

docker push 127.0.0.1:5000/imagename

我希望这也适用于你。

于 2022-01-05T19:47:46.267 回答
0

我认为善良的形象必须有所改变。我使用此页面中的脚本: https ://kind.sigs.k8s.io/docs/user/local-registry/

我能够创建一个新的集群和注册表。之后,我按照视频讲座将 explorecalifornia.com 图像推送到本地注册表没有问题。

于 2021-12-13T03:03:25.160 回答