Closed andriansandi closed 6 years ago
I'm guessing it's a typo, but using - ./.env:/var/www/html.env
would mount that file as /var/www/html.env
in the container.
Regardless, check the permissions of the .env
file on your local machine which you're mounting in the container. Permissions on mounted volumes will be the same both inside and outside of the container. If it's set as root
it will be root
in the container. If you change it to www-data
, it will be www-data
in the container.
I should note, if the local file you referenced in docker-compose.yml doesn't exist when you run docker-compose up
, the container will create a folder on your local machine with the root user.
If you don't have a www-data:www-data
user:group setup in OS X, what I described above doesn't really fly.
However, Docker For Mac does something interesting. If you update the file's permissions from within the container, it's permissions persist on the host as an extended attribute ls -@la .env
I have a problem that I wanted to mounted new file called .env, but in the host it created by root instead of www-data
Step to reproduce
docker-compose up -d
beforedocker-compose.yml
to mount new file- ./.env:/var/www/html.env
It's caused the application error.
How I can solved it ?