I'm trying to run wordpress inside docker.

I've been following this tutorial : https://www.sitepoint.com/how-to-use-the-official-docker-wordpress-image/

But when I run this command :

docker run -e WORDPRESS_DB_PASSWORD=xxxxxx -d --name wordpress --link wordpressdb:mysql -p -v "$PWD/":/var/www/html wordpress

The container crashes, and in the logs I can see things like :

tar: ./wp-admin: Cannot mkdir: Permission denied
  • In order to check it if that directory exists and its permissions, execute ls -la $PWD PS:This should be a comment but I do not have enough rep Are you sure you are in the right directory?
    – RuBiCK
    Commented Aug 21, 2017 at 6:24
  • Have you been tried to use absolute path?
    – RuBiCK
    Commented Aug 21, 2017 at 11:14

3 Answers 3


Try to run such command as root or grant user and group rights to the folder with chown.

That's only what comes to my mind for now.

  • I'm running it as root yes. And used chmod 777 on the folder I wanted to link
    – Loïc
    Commented Aug 21, 2017 at 2:45

Hm, i'll answer myself here I guess.

The problem was, I had "broken" volumes.

So, I've made a little script to "reset" docker and install wordpress. Careful it removes everything.


# remove images
docker rmi $(docker images -q)  
# remove containers
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)    
# remove volumes
docker volume rm $(docker volume ls -q)

echo "Type mysql root password : "
read mspass

docker run --name wordpressdb -e MYSQL_ROOT_PASSWORD=$mspass -e MYSQL_DATABASE=wordpress -d mysql:5.7

docker run -e WORDPRESS_DB_PASSWORD=$mspass --name wordpress --link wordpressdb:mysql -p -v "$PWD/":/var/www/html -d wordpress
  • What do you mean with broken volumes?
    – RuBiCK
    Commented Aug 27, 2017 at 14:59
  • I don't really know, it's just when I removed them everything worked fine
    – Loïc
    Commented Aug 27, 2017 at 18:25

Perhaps information like 1) the docker host OS details (RHEL, Centos, Ubuntu, etc) 2) the mounted directory permission (ls -al) would help to debug this issue...

This could be an SELinux issue as well, so disable SELinux and try

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.