Answers: <p>Hm, i'll answer myself here I guess.</p>
  
  <p>The problem was, I had "broken" volumes.</p>
  
  <p>So, I've made a little script to "reset" docker and install wordpress.
  Careful it removes everything.</p>
  
  <pre><code>#!/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
  </code></pre>
  
Answers: CC BY-SA 3.0
Answers: 2017-08-27T14:59:37.907Z
Answers: What do you mean with broken volumes?
Answers: RuBiCK
Answers: CC BY-SA 3.0
Answers: 2017-08-27T18:25:03.380Z
Answers: I don't really know, it's just when I removed them everything worked fine
Answers: Loïc
Answers: CC BY-SA 3.0
Answers: 2017-08-21T13:47:49.513Z
Answers: 2017-08-21T13:47:49.513Z
Answers: Loïc
Answers: <p>Try to run such command as root or grant user and group rights to the folder with chown.</p>
  
  <p>That's only what comes to my mind for now.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-08-21T02:45:46.930Z
Answers: I'm running it as root yes.
  And used chmod 777 on the folder I wanted to link
Answers: Loïc
Answers: CC BY-SA 3.0
Answers: 2017-08-20T20:26:36.150Z
Answers: 2017-08-20T20:26:36.150Z
Answers: Y V
Answers: <p>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...</p>
  
  <p>This could be an SELinux issue as well, so disable SELinux and try</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-08-21T07:19:25.287Z
Answers: 2017-08-21T07:19:25.287Z
Answers: Jeeva
Body: <p>I'm trying to run wordpress inside docker.</p>
  
  <p>I've been following this tutorial : <a href="https://www.sitepoint.com/how-to-use-the-official-docker-wordpress-image/" rel="noreferrer">https://www.sitepoint.com/how-to-use-the-official-docker-wordpress-image/</a></p>
  
  <p>But when I run this command :</p>
  
  <pre><code>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
  </code></pre>
  
  <p>The container crashes, and in the logs I can see things like :</p>
  
  <pre><code>tar: ./wp-admin: Cannot mkdir: Permission denied
  </code></pre>
  
Comments: CC BY-SA 3.0
Comments: 2017-08-21T06:24:43.223Z
Comments: 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?
Comments: RuBiCK
Comments: CC BY-SA 3.0
Comments: 2017-08-21T11:14:59.410Z
Comments: Have you been tried to use absolute path?
Comments: RuBiCK
Tags: <docker><linux>
Title: docker "Cannot mkdir: Permission denied"
UserDisplayName: Loïc
ThreadText: # docker "Cannot mkdir: Permission denied"
  
  (Asked by: username_0 on 2017-08-20)
  
  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
  
  ```
  
  **Tags:** docker, linux
  
  > **Comments:**
  > **username_1**: 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?  
  > **username_1**: Have you been tried to use absolute path?  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2017-08-21. Score: 2 | Accepted answer
  
  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
  
  ```
  
  > **Comments:**
  > **username_1**: What do you mean with broken volumes?  
  > **username_0**: I don't really know, it's just when I removed them everything worked fine  
  
  ---
  
  ### Answer by username_2 on 2017-08-20. Score: 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.
  
  > **Comments:**
  > **username_0**: I'm running it as root yes. And used chmod 777 on the folder I wanted to link  
  
  ---
  
  ### Answer by username_3 on 2017-08-21. Score: 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
  
  
  ---
  
  