Skip to content

Instantly share code, notes, and snippets.

@iRynoh
Last active September 22, 2019 20:51
Show Gist options
  • Save iRynoh/ef47128f6ade5b9a5840a3b86b5c8bfe to your computer and use it in GitHub Desktop.
Save iRynoh/ef47128f6ade5b9a5840a3b86b5c8bfe to your computer and use it in GitHub Desktop.
Laravel Docker Ubuntu 18.04 File permission - Cannot open log

When working with docker and laravel with linux distros sometimes the web server container cannot write to log files.

To workaround this you will have to do the following:

Inside the container

Find the www-data UID from the container

$ id -u www-data

In the host

Change the ownsership from the host to the www-data UID from the container

Let's assume that the uid is 82 (Alpine default www-data uid).

$ sudo chown 82:82 /path/to/laravel/ -R

Set an acl for your host user so you can write to the files.

$ sudo setfacl -Rm u:YOUR_USER:rwx,d:u:YOUR_USER:rwx /path/to/laravel/

That is it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment