I want to run my php website in a container with apache and php7 I am using this docker image : https://hub.docker.com/r/nimmis/apache-php7/

I run Fedora so I enter the example command given in docker hub in my terminal.

docker run -d -p 8080:80 -v {my_php_app_path}:/var/www/html nimmis/apache-php7

The container pull and run fine. But once i try to access the asset (on localhost:8080) I mounted to it, I receive a 403 error. So now i try to connect to the container to see what happens.

I use the command adviced by the author:

docker exec -ti <container id> /bin/bash

Once in it, I cd to /var/www/html all the file are presents but I cant read or ls in the folder. the root of the container cant do anythig with it. Here is what I get :

>>> root@a1f13dc4c29d:/var/www/html# ls
>>> ls: cannot open directory '.': Permission denied

Why is it that way ? Am I missing a step ?

Any help would be loved :D

1 Answer 1


SELinux prevent the docker filesystem to work in the intended way, to fix this issue just add the :Z flag at the end of the volume declaration. It goes something like this:

docker run -d -p 8080:80 -v {my_php_app_path}:/var/www/html:Z nimmis/apache-php7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.