title: Docker Compose Relative paths vs Docker volume
body: <p>I have a docker compose file for a website, which amongst a bunch of other containers for various purposes, includes a mysql database that will have persistent data.  At the moment the compose file specifies a relative path for the data, e.g.:</p>
  
  <pre> 
  mysql: 
    image: mysql:5.7
    container_name: sqldb
    volumes:
     - ./mysql_data/_data:/var/lib/mysql
  </pre>
  
  <p>and the folder structure:</p>
  
  <pre>
   --mysql_data
   --static_content
   docker-compose.yml
  </pre>
  
  <p>which means that at any point I can move the whole site (including persisted content) to another server by copying the whole folder and running docker-compose up.</p>
  
  <p>But reading about docker volumes it sounds like it is the preferred method (plus relative bind mount paths don't seem to be supported using "docker run", but work in compose) so I'm wondering if I need to change this approach to use volumes? Is there something inherently wrong with this relative binding approach? If I do switch to volumes, when moving the containers do I have to manually move the volumes (e.g. this method <a href="https://stackoverflow.com/questions/21597463/how-to-port-data-only-volumes-from-one-host-to-another">How to port data-only volumes from one host to another?</a>)?</p>