docker-compose volumes not mounting to host directories
<p>I'm using docker-compose for deployment, with a 2 <code>docker-compose.yml</code> setup where I'm building the image locally and pulling from docker hub on the server.</p>

<p>Besides building vs pulling an image, the volumes config is the same.</p>

<p>Locally:</p>

<pre><code>app:
  build: .
  volumes:
    - "/data/volume:/volume"
</code></pre>

<p>And on the server:</p>

<pre><code>app:
  image: username/repo:tag
  volumes:
    - "/data/volume:/volume"
</code></pre>

<p>In my Dockerfile:</p>

<pre><code>volume /volume
</code></pre>

<p>Locally my volume mounts to the specified directory fine, with files created by the app persisted there outside the container.  On the deployment server, however, this does not happen.</p>

<p>Files <strong>are</strong> however created and persisted through deploys, even though my deployment script runs <code>docker-compose down -v</code> which presumably removes named &amp; anonymous volumes on the container.</p>

<p>I'm sure I'm doing something wrong, but I can't see what.  Could it be a caching issue?  The volume configuration was not the same on initial deploy.</p>

<h2>More Info:</h2>

<p>I actually can't seem to <strong>force</strong> the images to be lost between deploys.  I ran:</p>

<pre><code>docker-compose down -v --rmi all --remove-orphans
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls -q)
</code></pre>

<p>... which I thought would leave me with a clean slate for redeploying, then:</p>

<pre><code>docker pull username/repo:tag
docker-compose build --no-cache --force-rm
docker-compose up -d
</code></pre>

<p>... and the files which are supposed to be in the mounted volume are <strong>still there</strong>, and there's still nothing in the mounted dir on the disk.  Any ideas?</p>

<h2>Still more info</h2>

<p>Running <code>docker inspect &lt;container&gt;</code> on the server yields a mount configuration like this:</p>

<pre><code>"Mounts": [
  "Source": "/data/volume",
  "Destination": "/volume",
  "Mode": "rw",
  "RW": true,
  "Propagation": "rprivate"
]
</code></pre>

<p>I notice there's no Driver specified, and not sure about the significance of "rprivate", but the Source and Destination do appear to be correct.</p>