Symbolic links might not work

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the containerization category.

Last Updated: 2024-11-23

Symbolic links made in the host machine won't work for code inside a virtual machine or container

e.g. in a Laravel piece of code running on Vagrant I ran this in my host machine

php artisan storage:link

On said host machine, it links to another host machine folder

ls -l public/storage
lrwxr-xr-x  1 jack  staff  65 Dec 16 15:55 public/storage -> /Users/jack/code/mycodebase/storage/app/public

This breaks the linkage it Vagrant.

You can get a feel for the issue by noticing it's possible to CD in on localhost. But within the container, it's impossible to cd to that directory

$ cd public/storage
cd: no such file or directory: public/storage