<p>Trying to utilize official <code>jetbrains\teamcity-agent</code> image on Kubernetes. I've managed to run Docker in Docker there but trying to build an ASP.NET Core image with <code>docker build</code> command failes on <code>dotnet restore</code> with</p>

<blockquote>
  <p>The HTTP request to 'GET <a href="https://api.nuget.org/v3/index.json" rel="noreferrer">https://api.nuget.org/v3/index.json</a>' has timed out after 100000ms.</p>
</blockquote>

<p>When I connect to the pod itself and try <code>curl</code>ing the URL it's super fast. So I assume network is not an issue. Thank for any advice.</p>

<h3>Update</h3>

<p>Trying to run a simple <code>dotnet restore</code> step from container worked. But not from inside the <code>docker build</code>.</p>

<h3>Update 2</h3>

<p>I've isolated the problem, it has nothing to do with nuget nor TeamCity. Is network related on the Kubernetes host.</p>

<p>Running simple <code>docker build</code> with this <em>Dockerfile</em>:</p>

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

<p>produces output:</p>

<pre><code>Step 1/3 : FROM praqma/network-multitool AS build
 ---&gt; 3619cb81e582
Step 2/3 : RUN route
 ---&gt; 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
 ---&gt; d79e864eafaf
Step 3/3 : RUN ping -c 4 google.com
 ---&gt; 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
</code></pre>

<p>Pods orchestrated by Kubernetes can access internet normally. I'm using Calico as network layer.</p>

Jan Zahradník
<p>I fix this issue by passing argument --disable-parallel to restore command which Disables restoring multiple projects in parallel.</p>

<blockquote>
  <p>RUN dotnet restore --disable-parallel</p>
</blockquote>
