title: How to map a docker containers directory to the host with docker-compose?
body: <p>Given following docker-compose.yml setup:</p>
  <pre><code>version: '3.7'
  
  services:
    reverse:
      container_name: nginx-reverse-proxy
      hostname: nginx-reverse-proxy
      image: nginx:stable
      ports:
        - 80:80
        - 433:433
      volumes:
        - type: bind
          source: ./config
          target: /etc/nginx
          consistency: consistent
  </code></pre>
  <p>this results in <code>./config</code> folder being mapped to the container <code>nginx-reverse-proxy</code> and therefore in an empty <code>/etc/nginx</code> directory inside the container.</p>
  <p><strong>Goal</strong>: <br />
  Mapping a folder <strong>from</strong> container <strong>to</strong> host. In my example <strong>from</strong> container <code>/etc/nginx</code> <strong>to</strong> the host <code>./config</code>.</p>
  <p>My current search constantly results in mapping a directoy <strong>from</strong> host <strong>to</strong> container (which i do not want).</p>
  <p>Any hints/solutions are appreciated. Thanks!</p>
  <p>My current solution is ugly:
  I created the container with docker and copied the files from <code>/etc/nginx</code> to <code>./config</code>. Removing the container and using the <code>docker-compose up</code> works and <code>nginx</code> starts because the needed files are already on the host.</p>
  <p>Edit: The folder is not present at creation. Docker compose is creating the folder as stated in the docs.</p>