gpt4 book ai didi

linux - docker build 无法连接到 http 服务器,即使它可以在命令行上访问

转载 作者:太空宇宙 更新时间:2023-11-04 12:05:16 26 4
gpt4 key购买 nike

我们有一个 Dockerfile,其中包含以下形式的命令

RUN dotnet restore --no-cache -s http://localhost:8081/repository/nuget-hosted/

当我们运行时

docker build . 

这一行遇到的错误是

Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:8081/repository/nuget-repo-name/FindPackagesById()?id='Package.Name''.
An error occurred while sending the request.
Couldn't connect to server
/usr/share/dotnet/sdk/2.1.101/NuGet.targets(104,5): error : Failed to retrieve information about 'Package.Name' from remote source 'http://localhost:8081/repository/nuget-repo-name/FindPackagesById()?id='Package.Name''.

但是,当我们在命令行中运行相同的命令时,dotnet restore 是成功的。

有问题的 nuget 服务器在同一台机器上运行。如果我们在浏览器中点击相同的 URL,则成功。

我们如何使运行在 localhoat:8081 的 nuget 服务器在 docker build 中可访问,以便成功创建 docker 镜像?

最佳答案

关于linux - docker build 无法连接到 http 服务器,即使它可以在命令行上访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50952004/

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