My host machine is a Windows 11 with WSL2.
I installed Rancher Desktop v0.7.1
With the containerd(nerdctl(v 0.15.0)) option and Kubernetes v1.23.1(latest)
Then I tried to build the following Dockerfile
# syntax=docker/dockerfile:experimental
#FROM openjdk:11 as builder <-- This one also fails.
FROM adoptopenjdk:11-jre-hotspot as builder
ENV NODE_ENV=development
WORKDIR /workspace/my-app
COPY . /workspace/my-app
RUN --mount=type=cache,target=/root/.gradle ./gradlew --no-watch-fs --no-daemon clean build -x test
Then I get the following exception
> [builder 4/4] RUN --mount=type=cache,target=/root/.gradle ./gradlew --no-watch-fs --no-daemon clean build -x test:
#10 0.585 Downloading https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
#10 130.6
#10 130.6 Exception in thread "main" java.net.ConnectException: Connection timed out (Connection timed out)
#10 130.6 at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
#10 130.6 at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
#10 130.6 at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
#10 130.6 at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
#10 130.6 at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
#10 130.6 at java.base/java.net.Socket.connect(Unknown Source)
#10 130.6 at java.base/sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
#10 130.6 at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
#10 130.6 at java.base/sun.net.NetworkClient.doConnect(Unknown Source)
#10 130.6 at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)
#10 130.6 at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
#10 130.6 at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
#10 130.6 at org.gradle.wrapper.Download.downloadInternal(Download.java:67)
#10 130.6 at org.gradle.wrapper.Download.download(Download.java:52)
#10 130.6 at org.gradle.wrapper.Install$1.call(Install.java:62)
#10 130.6 at org.gradle.wrapper.Install$1.call(Install.java:48)
#10 130.6 at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
#10 130.6 at org.gradle.wrapper.Install.createDist(Install.java:48)
#10 130.6 at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
#10 130.6 at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
------
Dockerfile:11
--------------------
9 |
10 | COPY . /workspace/my-app
11 | >>> RUN --mount=type=cache,target=/root/.gradle ./gradlew --no-watch-fs --no-daemon clean build -x test
--------------------
error: failed to solve: executor failed running [/bin/sh -c ./gradlew --no-watch-fs --no-daemon clean build -x test]: exit code: 1
FATA[0139] unrecognized image format
If I connect to the container and run the same line then gradlew download gradle application and it builds without problem.
This is my network configuration:
root@TEST:~/mcd-git/mcd-core# nerdctl network ls
root@TEST:~/mcd-git/mcd-core# nerdctl network ls --namespace k8s.io
NETWORK ID NAME FILE
0 bridge
host
none
If execute the same build in the k8s.io namespace I get the same error.
If I execute the same command in a different WSL distro with Docker then it builds correctly.
I'm probably missing a Proxy configuration or a CNI configuration but I don' know how to fix it, any help is appreciated.