can’t access images inside /public/storage
i have done php artisan storage:link
the files are visible when using my local environment but when switching to Docker environment with the same code, i can’t access them (not found)
my files owner is the same as in my docker config
i test it by visiting http://127.0.0.1:8000/storage/test.png
where test.png is inside public/storage
I have 3 services inside my docker-compose file
- Nginx
- PHP
- MYSQL
I think the problem from permissions but i can’t figure out the solution
2
Answers
if anyone faced the same issue.
i managed to solve this by removing the symlink created by laravel and make my own one from my nginx container based on the real path inside my container
As far as I know, each docker has an IP address. So, you have to start the server with the IP address of docker container. However, to avoid errors from docker’s dynamic IP address, you use
0.0.0.0
instead of the IP address of docker because0.0.0.0
means all IPv4 addresses on the local machine. To resolve your issue, you use the following command in docker.Note:
Maybe you will get another error, let me know if you meet them.