title: Docker (compose) fails to build container when mounting single file from official Wordpress image
body: <p>I'm experiencing the problem with mounting files, opposite to directories which works pretty fine. Specific problem is related to the <a href="https://hub.docker.com/_/wordpress/" rel="nofollow">Wordpress's official image</a> and file <em>wp-config.php</em> (or any other).</p>
  
  <p>Here's the content of <strong>docker-compose.yml</strong> file:</p>
  
  <pre class="lang-none prettyprint-override"><code>web:
    image: wordpress
    ports:
      - "80:80"
    volumes:
      - ./src/wordpress/wp-content:/var/www/html/wp-content
      - ./src/wordpress/wp-config.php:/var/www/html/wp-config.php
    environment:
      WORDPRESS_DB_NAME: dummyname
    links:
      - db:mysql
  db:
    image: mysql
    ports:
      - "3306:3306"
    volumes:
      - mysql-data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: dummypass
  </code></pre>
  
  <p>When I run the command <strong>docker-compose up</strong> or <strong>docker run</strong> output is the same:</p>
  
    <pre class="lang-none prettyprint-override"><code>WordPress not found in /var/www/html - copying now...
  WARNING: /var/www/html is not empty - press Ctrl+C now if this is an error!
  + ls -A
  wp-config.php
  + sleep 10
  Complete! WordPress has been successfully copied to /var/www/html
  sed: couldn't edit wp-config.php: not a regular file
  </code></pre>
  
  <p>In both cases, <em>wp-config.php/</em> is created, but as directory, not as a file.</p>
  
  <p>Sometimes error might be:</p>
  
    <pre class="lang-none prettyprint-override"><code>ERROR: Cannot start container &lt;container id&gt;: [9] System error: not a directory
  </code></pre>
  
  <p>If I comment the line which is mounting <em>wp-config.php</em> file, everything works as expected.</p>
  
  <p><strong>docker inspect</strong> gives correct info:</p>
  
  <pre><code>"HostConfig": {
      "Binds": [
          "/home/dummyuser/projects/dummyproject/src/wordpress/wp-config.php:/var/www/html/wp-config.php:rw"
      ],
  ...
  "Mounts": [
      {
          "Source": "/home/dummyuser/projects/dummyproject/src/wordpress/wp-config.php",
          "Destination": "/var/www/html/wp-config.php",
          "Mode": "rw",
          "RW": true,
          "Propagation": "rprivate"
      },
      {
          "Name": "b8649d2edbfb043a05bce96622fbbc1c10b24b9f65736407efe961c3ec550b7a",
          "Source": "/var/lib/docker/volumes/b8649d2edbfb043a05bce96622fbbc1c10b24b9f65736407efe961c3ec550b7a/_data",
          "Destination": "/var/www/html",
          "Driver": "local",
          "Mode": "",
          "RW": true,
          "Propagation": ""
      }
  ],
  </code></pre>
  
  <p><em>Environment:</em></p>
  
    <pre class="lang-none prettyprint-override"><code>Linux 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  Docker version 1.10.3, build 20f81dd
  docker-compose version 1.5.2, build 7240ff3
  </code></pre>
  
  <p>Things I've tried, and didn't get any results:</p>
  
  <ul>
  <li>using <strong>docker run</strong> instead of <strong>docker-compose</strong> (equal behavior/results)</li>
  <li>instead of ./src/wordpress to use absolute path, either by naming it or using <strong>$PWD</strong></li>
  <li>moving project outside of <strong>home</strong> folder</li>
  <li>commenting the line for volume of wp-config.php file, creating container, then stopping it, uncommenting previously commented line, and starting it again</li>
  </ul>
  
  <p>Not quite sure, but when watching on <a href="https://github.com/docker-library/wordpress/blob/df190dc9c5752fd09317d836bd2bdcd09ee379a5/apache/docker-entrypoint.sh" rel="nofollow">entrypoint script</a>, if mounting is performed before Wordpress tar archive is extracted to /var/www/html, that might be the reason why <em>wp-config.php</em> file (or any other) cannot be found and therefore mounted. With directories, it seems it's not a problem.</p>