Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker - maven connect to specific repository in runtime

I've an image which needs to connect to a repository in runtime, but it seams that Docker container is not able to read ~/.m2/settings.xml file located in host machine.

Is there any way to let docker now where maven configuration file is located? Or actually import the maven configuration file to the container?

like image 425
bsferreira Avatar asked Jan 21 '15 23:01

bsferreira


1 Answers

You can do this by creating a volume mapping

docker run ... -v /path/on/host/settings.xml:/home/me/.m2/settings.xml ....

see also the following example where the repository is run within a container and accessed via a link:

  • How to dockerize maven project? and how many ways to accomplish it?
like image 127
Mark O'Connor Avatar answered Nov 14 '22 22:11

Mark O'Connor