Docker nuget连接超时

问题描述 投票:0回答:1

[尝试在Kubernetes上使用官方jetbrains\teamcity-agent图像。我设法在Docker中运行Docker,但是尝试用docker build命令构建ASP.NET Core映像在dotnet restore上失败,并带有

对“ GET https://api.nuget.org/v3/index.json”的HTTP请求在100000ms后超时。

当我连接到Pod本身并尝试curl输入URL时,它非常快。因此,我认为网络不是问题。感谢您的任何建议。

更新

尝试从容器工作中运行一个简单的dotnet restore步骤。但不是从docker build内部。

更新2

我已经隔离了问题,与nuget或TeamCity无关。网络在Kubernetes主机上是否相关。

使用此Dockerfile运行简单的docker build

FROM praqma/network-multitool AS build
RUN route
RUN ping -c 4 google.com

产生输出:

Step 1/3 : FROM praqma/network-multitool AS build
 ---> 3619cb81e582
Step 2/3 : RUN route
 ---> Running in 80bda13a9860
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.17.0.1      0.0.0.0         UG    0      0        0 eth0
172.17.0.0      *               255.255.0.0     U     0      0        0 eth0
Removing intermediate container 80bda13a9860
 ---> d79e864eafaf
Step 3/3 : RUN ping -c 4 google.com
 ---> Running in 76354a92a413
PING google.com (216.58.201.110) 56(84) bytes of data.

--- google.com ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 53ms

由Kubernetes精心安排的Pod可以正常访问Internet。我正在使用Calico作为网络层。

kubernetes routing timeout
1个回答
0
投票

我的行为完全相同:我有包含几个nuget依赖项的解决方案它在本地计算机上构建没有任何问题。它在Windows构建代理上没有任何问题地构建它在docker主机上构建没有任何问题但是然后我尝试在docker的build agent中构建它-我有很多这样的消息:

Failed to download package 'System.Threading.4.0.11' from 'https://api.nuget.org/v3-flatcontainer/system.threading/4.0.11/system.threading.4.0.11.nupkg'.
  The download of 'https://api.nuget.org/v3-flatcontainer/system.threading/4.0.11/system.threading.4.0.11.nupkg' timed out because no data was received for 60000ms

我通常可以通过docker容器从nuget.org ping和卷曲页面。

所以我认为这是一些特殊情况。我找到了一些有关MTU的信息,但我尚未对其进行测试。

UPDATE最初的问题可能是连接到k8s-我的容器在基于ubuntu 18.04的k8s集群内工作,并带有法兰绒ang k8s v1.16在我的本地计算机上(基于Win),所有工作都没有任何问题...但是很奇怪,因为我有很多服务可以在此群集中正常工作! (例如港口,灰色原木,积家等)

UPDATE 2好的,现在我什么都可以理解。我尝试执行

curl https://api.nuget.org/v3/index.json 

并且可以获取文件内容而没有任何错误

此后我尝试运行

wget https://api.nuget.org/v3-flatcontainer/system.threading/4.0.11/system.threading.4.0.11.nupkg

并成功下载软件包

但是在运行dotnet restore之后,我仍然收到超时错误

© www.soinside.com 2019 - 2024. All rights reserved.