I am trying to clone a git project and do mvn package
inside a docker. But maven is unable to connect to network to download dependencies. This is the Dockerfile
:
FROM java:8
FROM maven
ADD id_rsa /root/.ssh/id_rsa
ADD known_hosts /root/.ssh/known_hosts
RUN git clone git@myhub.mygithub.com:project/myapp.git
WORKDIR myapp
RUN mvn package
This is the maven build command:
sudo docker build --build-arg http_proxy=http://proxy.in.my.com:80
--build-arg https_proxy=http://proxy.in.my.com:80
--build-arg ftp_proxy=http://proxy.in.my.com:80
--build-arg no_proxy=localhost,127.0.0.1,.us.my.com,.my.com
-t myapp .
I am getting the following error during mvn package
:
Downloading: https://repo.maven.apache.org/maven2/org/jacoco/jacoco-maven-plugin/0.7.6.201602180812/jacoco-maven-plugin-0.7.6.201602180812.pom
[ERROR] Plugin org.jacoco:jacoco-maven-plugin:0.7.6.201602180812 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.jacoco:jacoco-maven-plugin:jar:0.7.6.201602180812: Could not transfer artifact org.jacoco:jacoco-maven-plugin:pom:0.7.6.201602180812 from/to central (https://repo.maven.apache.org/maven2): Network is unreachable (connect failed) -> [Help 1]