I am trying to run a Dockerize and Open Source project that I created in my second year at college, this project uses MariaDB, phpMyAdmin and the PHP / Yii Framework.
My goal is to make it ready to use using just a simple docker-compose up command.
I managed to establish a connection between phpMyAdmin and DB, and now I'm stuck on trying to get Docker for the relative path to the database volume in order to make it consistent.
Here is what I have regarding volume setting:
volumes: - './database/mysql/:/var/lib/mysql'
This is storing database files inside the project, and then I can ignore these files in .gitignore The problem is that when I launch docker-compose up with this configuration, I get:
Invalid volume specification: 'C:\Users\MySelf\coding\my_app\database\mysql:/var/lib/mysql:rw'
As for the host, I use Windows with the Docker Toolbox, but I want docker-compose.yml work regardless of the OS.
I saw other similar questions, but their error came from problems with absolute paths in Windows that I am not looking for.
EDIT: adding the correct final docker-compose.yml file, hope it can help
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
source share