Permission issues with Apache inside Docker Permission issues with Apache inside Docker apache apache

Permission issues with Apache inside Docker


I just ran into this after posting a similar question at Running app inside Docker as non-root user.

My guess is you can't chmod/ chown files that were added via the ADD command. – thom_nic Jun 19 at 14:14

Actually you can. You just need to issue a a RUN command after the ADD for the file location that will be INSIDE your container. For example

ADD extras/dockerstart.sh /usr/local/servicemix/bin/RUN chmod 755 /usr/local/bin/dockerstart.sh

Hope that helps. It worked for me.


I encountered a similar issue; however my container was using VOLUME to map directories across the container.

Changing the permissions on the directory that maps to /var/www/html itself remedied the 403 Forbidden errors.

docker-host$ ls -ld /var/www/htmldrwxr--r--  53 me  staff  1802 Mar  8 22:33 .docker-host$ chmod a+x /var/www/htmldocker-host$ ls -ld /var/www/htmldrwxr-xr-x  53 me  staff  1802 Mar  8 22:33 .

Note that chmod must be applied on the Docker host, not within the container. Executing it within the container effects no change to the directory.

docker-container$ chmod a+x /var/www/htmldocker-container$ ls -ld /var/www/htmldrwxr--r--  53 me  staff  1802 Mar  8 22:33 .