Say, I have a local dir structure of /var/lib/jenkins and on the resultant container i have the same dir stucture. Now, i need that the jenkins user created through Dockerfile should be able to access the /var/lib/jenkins/.m2/repository existing on local machine. I have mapped the container jenkins userid to the jenkins userid on local using usermod and groupmod in Dockefile. However, I need that /var/lib/jenkins/.m2/repository on local should be accessible inside the container for all processes on it, in a way that local machines's repository maps to container path
Effectively, i need to achieve below cmd inside the dockerfile
docker run -it --name my_container -v /var/lib/jenkins/.m2/repository:/var/lib/jenkins/.m2/repository my_image
Any guidance on this will be helpful.