MariaDB is a very popular open source relational database. It is a fork of MySQL and is run by some of the original developers of MySQL before Oracle acquired the MySQL project.
Installation & Basic Usage
Please see the Introduction & Concepts, then reference the examples below on adding this service to your project.
Add this section to your main
docker-compose.yml file, which will act as a "base". All environments will reference this file, so you can simply manage everything from one location.
mariadb: image: mariadb:10.7
See the official MariaDB DockerHub page for specific version references.
mariadb: networks: - web-dev environment: MYSQL_ROOT_PASSWORD: "rootpassword" MARIADB_DATABASE: "mydatabase" MARIADB_USER: "databaseuser" MARIADB_PASSWORD: "databasepassword" volumes: # Add volume for all database files - ./_volumes/mysql/database_data/:/var/lib/mysql # Add volume for custom configurations - ./_volumes/mysql/conf.d/:/etc/mysql/conf.d - ./_volumes/mysql/docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d ports: # Publish the port so things like Sequel Pro or TablePlus can connect - target: 3306 published: 3306 mode: host
All persistent storage will be located in a
./_volumes/ folder on your project.
Add this to your
If you copy and paste from above, be sure to define your network at the bottom of the file.
See our open source project called Financial Freedom for more examples.