Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symbolic Link Host to Docker Container

Tags:

docker

symlink

Well, Basically I wanna create a Symbolic link "ln -s" from my host to my container.

To sum up: the host folder .m2 of the host must have a Symbolic link to the .m2 folder inside my container, something like: $ ln -s containerIp:/root/.m2 myContainerAlias

I've seen the below posts but they didn't help me since I don't wanna copy the files to my local host.

Docker - copy file from container to host

Apache in Docker says: Symbolic link not allowed

https://omarabid.com/symlink-to-a-mounted-volume-in-docker/

Edited:

I've found another valuable Issue here:

How to mount a directory in the docker container to the host? Thanks...

like image 676
Bevilaqua Avatar asked Feb 05 '16 17:02

Bevilaqua


1 Answers

Sounds like you're trying to optimize a Maven build running inside a container?

docker run -it --rm -w /opt/maven \
   -v $PWD:/opt/maven \
   -v $HOME/.m2:/root/.m2 \
   maven:3.3-jdk-8 \
   mvn clean install

Example

  • How to build a docker container for a java app
like image 161
Mark O'Connor Avatar answered Nov 15 '22 04:11

Mark O'Connor