title: Docker mysql container doesn't persist data despite using volumes. Why?
body: <p>I am running two docker containers.</p>
  <ul>
  <li>mysql</li>
  <li>adminer</li>
  </ul>
  <p>I want to persist my database, therefore I use <strong>volumes</strong> in my docker-compose file. Still I lose data whenever I restart the containers (docker-compose down and up).</p>
  <p>What I am missing? (I am on ubuntu 20.04)</p>
  <pre><code>services:
    adminer:
      image: adminer
      restart: always
      ports:
        - 8080:8080
    db:
      image: mysql:latest
      restart: always
      environment:
        MYSQL_ROOT_PASSWORD: 'example' # TODO: Change this      
      volumes:
        - &quot;./config/my.conf:/etc/mysql/conf.d/config-file.cnf&quot;
        - &quot;./data:/var/lib/mysql:rw&quot;
        
  </code></pre>