Why maven cannot download poms in the docker?
dockerfile
FROM maven:3.5.4
MAINTAINER xxx <xxx@xxx.com>
COPY . /app
WORKDIR /app
RUN mvn clean compile
CMD mvn spring-boot:run
Building webapp
Step 1/6 : FROM maven:3.5.4
---> 745b8a8c4bc7
Step 2/6 : MAINTAINER xxx <xxx@xxx.com>
---> Using cache
---> 86bfe1b29459
Step 3/6 : COPY . /app
---> Using cache
---> 2013b90d35bb
Step 4/6 : WORKDIR /app
---> Using cache
---> c735cc45bcd7
Step 5/6 : RUN mvn clean compile
---> Running in 5a9db90f7b13
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.0.0.RELEASE/spring-boot-starter-parent-2.0.0.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for io.github.xxx:spring-boot-my-demo:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.RELEASE from/to central (https://repo.maven.apache.org/maven2): Invalid argument or cannot assign requested address and 'parent.relativePath' points at no local POM @ line 14, column 10
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project io.github.xxx:spring-boot-my-demo:0.0.1-SNAPSHOT (/app/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for io.github.xxx:spring-boot-my-demo:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.RELEASE from/to central (https://repo.maven.apache.org/maven2): Invalid argument or cannot assign requested address and 'parent.relativePath' points at no local POM @ line 14, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
ERROR: Service 'webapp' failed to build: The command '/bin/sh -c mvn clean compile' returned a non-zero code: 1
And if I curl directly:
curl https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.0.0.RELEASE/spring-boot-starter-parent-2.0.0.RELEASE.pom
curl: (7) Couldn't connect to server
It does’t work too. But the curl works on other websites.
How can I fix it?