Issue
I have a nexus docker container running on Port 8081, where I have deployed a JAR file.
I have a simple Java + Maven project, which downloads few dependencies from the Central and this one particular JAR from Nexus. I have a customized settings.xml to download
- Below is the snapshot:
(a) Dockerfile, which tries to builds an image
(b) Customized settings.xml
(c) pom.xml: distribution management section
When building (docker build -t= .), it downloads all dependencies from central, but fails to connect to the nexus and download.
*Note: Since everything is for learning purpose, everything is on my PC i.e localhost.
Update:
Below is the port mapping of docker containers.
Solution
docker build
runs in a separate container where there is nothing under localhost:8081. Try to build using your host network:
docker build -t imagename --network host .
Answered By - Kesha
Answer Checked By - Pedro (JavaFixing Volunteer)