title: How to mount a single file in a volume
body: <p>I am trying to dockerize a PHP application. In the dockerfile, I download the archive, extract it, etc.</p>
  <p>Everything works fine. However, if a new version gets released and I update the dockerfile, I have to reinstall the application, because the config.php gets overwritten.</p>
  <p>So I thought I can mount the file as a volume, like I do with the database.</p>
  <p>I tried it two ways, with a volume and a direct path.</p>
  <p>docker-compose:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: '2'
  services:
    app:
      build: src
      ports:
        - &quot;8080:80&quot;
      depends_on:
        - mysql
      volumes:
        -  app-conf:/var/www/html/upload
        -  app-conf:/var/www/html/config.php
      environment:
        DB_TYPE: mysql
        DB_MANAGER: MysqlManager
  
    mysql:
      image: mysql:5.6
      container_name: mysql
      volumes:
        - mysqldata:/var/lib/mysql
      ports:
        - 3306:3306
      environment:
        MYSQL_ROOT_PASSWORD:
        MYSQL_DATABASE:
        MYSQL_USER:
        MYSQL_PASSWORD:
  
  volumes:
    mysqldata:
    app-conf:
  </code></pre>
  <p>Which results in the error:</p>
  <p>And I tried it with a given path, as a mounted volume.</p>
  <pre><code>/src/docker/myapp/upload:/var/www/html/upload
  /src/docker/myapp/upload:/var/www/html/config.php
  </code></pre>
  <p>However, both ways are not working. With the mounted volume, I see that upload gets created.</p>
  <p>But then it fails with:</p>
  <blockquote>
  <p>/var/www/html/config.php\&quot; caused \&quot;not a directory\&quot;&quot;&quot;</p>
  </blockquote>
  <p>If I try it with</p>
  <pre><code>/src/docker/myapp/upload/config.php:/var/www/html/config.php
  </code></pre>
  <p>Docker creates the upload folder and then a config.php folder. Not a file.</p>
  <p>Or is there another way to persist the config?</p>