visit
mariadb-data
. This is where all db data will be stored, even if container is restarted, data will be there.MYSQL_ROOT_PASSWORD: qwerty
- sets root password for mariadb container.PMA_ARBITRARY=1
- adds "server" input field to phpmyadmin login page (this way you can use this phpmyadmin with an external MySQL DB, and not just this local setup)PMA_HOST=mariadb
- told phpmyadmin how to connect to mariadbphpmyadmin - 8000:80
- this maps inner port 80 from inside the container, to port 8000 on my host machinedepends_on
" - prevents container to start before other container, on which it dependsdocker-compose up -d
myapp.loc/
- and still see phpinfo pagemyapp.loc:8000
- see phpmyadmin, I can login using root/qwerty credentialsThis can be achieved by modifying
mariadb
section with:command: "mysqld --init-file /data/application/init.sql"
volumes:
- ./init.sql:/data/application/init.sql
init.sql
- is an existing DB dump./data/application/init.sql
locationmysqld --init-file
" command - I tell mysql to start and import init.sqldocker container ls
docker exec -i docker_mariadb_1 mysql -uroot -pqwerty DB_NAME < your_local_db_dump.sql
docker exec -i docker_mariadb_1 mysqldump -uroot -pqwerty DB_NAME > your_local_db_dump.sql