尝试利用官方jetbrains\teamcity-agent
Kubernetes 上的图像。我已经设法在 Docker 中运行 Docker,但尝试使用以下命令构建 ASP.NET Core 映像docker build
命令失败于dotnet restore
with
对“GET”的 HTTP 请求https://api.nuget.org/v3/index.json https://api.nuget.org/v3/index.json' 100000 毫秒后超时。
当我连接到 Pod 本身并尝试时curl
读取 URL 速度非常快。所以我认为网络不是问题。感谢您的任何建议。
Update
尝试运行一个简单的dotnet restore
从容器中走出来的步骤有效。但不是从内部docker build
.
Update 2
我已经隔离了该问题,它与 nuget 或 TeamCity 无关。与 Kubernetes 主机上的网络相关。
跑步简单docker build
有了这个Dockerfile:
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可以正常上网。我使用 Calico 作为网络层。