I'm running a custom Docker image based on the official php-fpm image, with just minor tweaks. Inside the host machine I have a folder containing some images I would like to server, so I am running the container and binding the host image folder to a folder in my container like /home/host/images:/var/www/storage/images
. This goes well and if I bash into the container I see the files there.
My problem comes when I symlink the folder from the public folder in the container like ln -s /var/www/storage/images /var/www/public/images
.
The link seems correct and I can navigate there using the shell and see for example my test.png
image, but whenever I try to server any image for example https://my-web-app.com/images/test.png
I get a 404.
However, from inside the containers shell I've created another folder like /var/www/storage/images2
and then moved test.png
and then updated my link like ln -s /var/www/storage/images /var/www/public/images2
and then tested https://my-wen-app.com/images/test.png
and it works!
Why can't I link my bound folder but I can link this new folder that I just created? Is there anything else to do when binding to allow this link to work?