在Docker中编译Spark导致java.net.SocketException

时间:2018-03-16 15:09:58

标签: maven apache-spark docker socketexception

我正在Docker中编译Spark(docker build)。在某些时候,编译过程陷入困境:

[INFO] ------------------------------------------------------------------------
[INFO] Building Spark Project Tools 2.3.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/clapper/classutil_2.11/1.1.2/classutil_2.11-1.1.2.pom
Downloaded: https://repo.maven.apache.org/maven2/org/clapper/classutil_2.11/1.1.2/classutil_2.11-1.1.2.pom (3 KB at 166.7 KB/sec)
....
Downloaded: https://repo.maven.apache.org/maven2/org/ow2/asm/asm/5.1/asm-5.1.jar (53 KB at 1087.8 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/ow2/asm/asm-commons/5.1/asm-commons-5.1.jar (47 KB at 1047.5 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/clapper/grizzled-scala_2.11/4.2.0/grizzled-scala_2.11-4.2.0.jar (626 KB at 6581.1 KB/sec)
Mar 16, 2018 2:28:28 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo.maven.apache.org:443: Connection timed out (Read failed)
Mar 16, 2018 2:28:28 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo.maven.apache.org:443

显然,这似乎不是一个网络问题,因为之前的下载成功了。此外,当我重复构建过程时,它将在同一点失败。

我对可能出现问题的想法已经不多了。任何帮助表示赞赏。

编辑:偶尔会发生构建过程最终(几分钟后)下载一个额外的依赖项。但这是不可接受的:

Downloaded: https://repo.maven.apache.org/maven2/org/ow2/asm/asm-tree/5.1/asm-tree-5.1.jar (29 KB at 0.0 KB/sec)

1 个答案:

答案 0 :(得分:0)

要确保问题与Docker无关,请使用主机网络模式构建映像:

docker build --network=host ...

这将使容器在构建时使用主机的网络堆栈。