title: Docker volumes MariaDB Windows
body: <p>I am trying to Dockerize and Open Source a project I created in second year of college, this project uses MariaDB, phpMyAdmin and PHP/Yii Framework.</p>
  
  <p>My objective is to make it ready to go using only a simple
  <code>docker-compose up</code>
  command.</p>
  
  <p>I managed to get the connection between phpMyAdmin and the DB working and now I am stuck on trying to get Docker to have a relative path to a database volume, to make it consistent.</p>
  
  <p>Here is what I have regarding the volume mounting:</p>
  
  <pre><code>volumes:
    - './database/mysql/:/var/lib/mysql'
  </code></pre>
  
  <p>This is storing the database files inside the project and then I can ignore those files in <code>.gitignore</code>
  The problem is when I run <code>docker-compose up</code> with this configuration I get:</p>
  
  <p><code>Invalid volume specification: 'C:\Users\MySelf\coding\my_app\database\mysql:/var/lib/mysql:rw'</code></p>
  
  <p>Regarding the host, I am using a Windows with Docker Toolbox but I want the <code>docker-compose.yml</code> to work regardless of the OS.</p>
  
  <p>I have seen other questions similar but their error came from problems with absolute paths on Windows which I am not looking for.</p>
  
  <p><strong>EDIT: Adding the correct final docker-compose.yml, hopefully it can help</strong></p>
  
  <pre><code>version: '2'
  services:
    web_db:
      build: ./database/mysql
      command: "mysqld --innodb-buffer-pool-size=20M"
      volumes:
        - ./database/mysql/data/:/var/lib/mysql
        - ./database/mysql/initDB/create_tables.sql:/docker-entrypoint-initdb.d/create_tables.sql
      environment:
        MYSQL_ROOT_PASSWORD: 'YOURPASSWORD'
        MYSQL_DATABASE: 'support-technique'
        MYSQL_ROOT_HOST: '172.17.0.1'
      ports:
        - "3306:3306"
      container_name: web_db
  
    web:
      build: .
      depends_on:
        - web_db
      links:
        - web_db:db
      ports:
        - "80:80"
  
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      depends_on:
        - web_db
      links:
        - web_db:mysql
      ports:
        - "8181:80"
      environment:
  PMA_HOST: mysql
  </code></pre>