title: Wordpress cli permission denied error in docker
body: <p>I am creating a image of <code>wordpress cli</code> using <code>wordpress</code> image.</p>
  
  <p>Here the Dockerfile I am using for the image:</p>
  
  <pre><code>FROM wordpress:latest
  RUN cd /tmp &amp;&amp; echo "Installing WP-CLI" &amp;&amp; curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &amp;&amp; chmod +x wp-cli.phar &amp;&amp; echo "Permission setted" &amp;&amp; mv wp-cli.phar /usr/local/bin/wp &amp;&amp; echo "file moved" &amp;&amp; chmod +x /var/www/html &amp;&amp; echo "success permission" &amp;&amp; wp core install --path= `/var/www/html`  --allow-root &amp;&amp; echo "Setting Username and Password" &amp;&amp; wp core install --url="localhost"  --title="My First Blog" --admin_user="username" --admin_password="password" --admin_email="admin@mail.com"
  </code></pre>
  
  <p>But it shows error. I have added the steps showing in the Output.</p>
  
  <pre><code>Step 1/7 : FROM wordpress:latest
   ---&gt; fc03dc56d371
  Step 2/7 : RUN cd /tmp &amp;&amp; echo "Installing WP-CLI" &amp;&amp; curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &amp;&amp; chmod +x wp-cli.phar &amp;&amp; echo "Permission setted" &amp;&amp; mv wp-cli.phar /usr/local/bin/wp &amp;&amp; echo "file moved" &amp;&amp; chmod +x /var/www/html &amp;&amp; echo "success permission" &amp;&amp; wp core install --path= `/var/www/html`  --allow-root &amp;&amp; echo "wp success" &amp;&amp; wp cache set my_key my_value my_group 300
   ---&gt; Running in b9b293a11137
  Installing WP-CLI
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100 5412k  100 5412k    0     0   250k      0  0:00:21  0:00:21 --:--:--  316k
  Permission setted
  file moved
  success permission
  /bin/sh: 1: /var/www/html: Permission denied
  Error: This does not seem to be a WordPress installation.
  Pass --path=`path/to/wordpress` or run `wp core download`.
  </code></pre>
  
  <p>I don't know how to fix permission error in Docker. I used <code>chmod</code> but it fails.I tried this link <a href="https://stackoverflow.com/questions/44881489/permission-denied-error-in-docker">permission denied error in docker</a> . But none has answered yet. Help me with some solutions.</p>