How to work with symbolic links inside docker container?

lets suppose we have a host directory /Users/{username}/app having symlink /Users/{username}/app/lib pointing to original/source directory /Users/{username}/lib

/Users/{username}/app is mounted insider docker as /var/www, so there is symlink /var/www/lib inside docker container pointing to /Users/{username}/lib, as path /Users/{username}/lib don’t exists in docker container symlink will not work insider docker container.

In order to work symbolic links inside docker container we need to mount /Users/{username}/lib inside docker container at same path as in host machine i.e. /User/{username}/lib

Now we have two volumes mounted insider docker container

/Users/{username}/app -> /var/www

/Users/{username}/app/lib -> /Users/{username}/lib

Thats way docker container will be able to populate symbolic in sider docker container

 

Leave a Comment

Your email address will not be published. Required fields are marked *

×

Hello!

Click any contact below to chat on WhatsApp

× How can I help you?