Install docker containers such as nginx, which cannot be accessed externally.

recently I wanted to run laravel, with docker, so I searched docker hub and found this image

.

so I only share app and public according to the document given by him. There is no exception in external access, but I will report an error about missing package (because the vendor is different), so I can be sure that this image is fine.

but if I change and share the entire project -v $PWD/:/var/www/laravel , which is currently in the root directory of the project, I will report an error:

clipboard.png

I try to exec into the container, and executing curl localhost, inside the container will also make an error.

what is the reason for asking?

Feb.28,2021

this may be a permission problem. Some directories other than [app and public] may have write permissions


Don't know laravel, it looks like you want to map all the directories in this directory besides the three app/vendor/public directories, there are other directories. If you map like this, you will lose the other files. It can't be accessed in the container.

-v host directory: container directory
this parameter maps the host directory to the container directory. To access the container directory within the container is to access the host directory this directory. I don't know if you can read it.

Menu