5

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 127.0.0.1:8080:80 -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
Loïc
  • 179
  • 1
  • 1
  • 6
  • 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 Aug 21 '17 at 06:24
  • Have you been tried to use absolute path? – RuBiCK Aug 21 '17 at 11:14

3 Answers3

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.

Y V
  • 31
  • 1
2

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.

#!/bin/bash

# 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 127.0.0.2:8080:80 -v "$PWD/":/var/www/html -d wordpress
Loïc
  • 179
  • 1
  • 1
  • 6
1

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

Jeeva
  • 436
  • 4
  • 3