title: docker-compose using volume from exisiting container
body: <p>New to docker and docker-compose, have written compose file that starts couple of services one of which relies on mongo database.  I downloaded mongo image a while back and loaded it with data in a container.  When I start my mongo instance up via docker-compose starts a new container based on empty image so don't get the data.  </p>
  
  <p>Been reading about volumes as a way of trying to get compose to use the data from the existing container and have tried several permutations now and just can't get it to find the data.</p>
  
  <p>When I start the container with the data and do inspect I get :</p>
  
  <pre><code>    "Mounts": [
          {
              "Type": "volume",
              "Name": "3f78b88e3e06f31d5f65a45bb1cb964245551875218d065162625cc73e662b1e",
              "Source": "/var/lib/docker/volumes/3f78b88e3e06f31d5f65a45bb1cb964245551875218d065162625cc73e662b1e/_data",
              "Destination": "/data/configdb",
              "Driver": "local",
              "Mode": "",
              "RW": true,
              "Propagation": ""
          },
          {
              "Type": "volume",
              "Name": "d3f89470c9f8c53b55c30338f691eb1586600343004c502feffe8f81091d7d5c",
              "Source": "/var/lib/docker/volumes/d3f89470c9f8c53b55c30338f691eb1586600343004c502feffe8f81091d7d5c/_data",
              "Destination": "/data/db",
              "Driver": "local",
              "Mode": "",
              "RW": true,
              "Propagation": ""
          }
      ],
  </code></pre>
  
  <p>So am I right in saying I need to somehow get new container to use these mount points using volume tag ?</p>
  
  <p>Have tried:</p>
  
  <pre><code>volumes:
    - type: volume
      source: /var/lib/docker/volumes/3f78b88e3e06f31d5f65a45bb1cb964245551875218d065162625cc73e662b1e/_data
      target: /data/configdb
      volume:
        nocopy: true
  
    - type: volume
      source: /var/lib/docker/volumes/d3f89470c9f8c53b55c30338f691eb1586600343004c502feffe8f81091d7d5c/_data
      target: /data/db
      volume:
        nocopy: true
  </code></pre>
  
  <p>and : </p>
  
  <pre><code>volumes:
    - /data/configdb:/var/lib/docker/volumes/3f78b88e3e06f31d5f65a45bb1cb964245551875218d065162625cc73e662b1e/_data
    - /data/db:/var/lib/docker/volumes/d3f89470c9f8c53b55c30338f691eb1586600343004c502feffe8f81091d7d5c/_data
  </code></pre>
  
  <p>But to be honest grasping at straws, any help in an example of what I should be doing to use the exisiting data would be much appreciated.</p>
  
  <p>Lawrence </p>