- Install
dockeranddocker-composee.g. via
pacman -S docker docker-compose- Start
dockerde.g. as a systemd process:
systemctl start docker- Download the provided
compose.yamland run it via docker compose
curl https://gist.githubusercontent.com/Rafisto/b7c8229e066f140088ea8b993666ae11/raw/98ee2e47df36bc2647b88210eb68bd05e49e3517/compose.yaml -o compose.yamldocker compose up -d # start the container in detached terminal modeTip
To add $USER to the docker group see docker post-install guide
- Execute an SQL shell inside a container
docker exec -it mariadb-container mariadb -D database -u root -prootpassword # double p is intentional, see mariadb reference- Use SQL as you would normally do:
SHOW TABLES;- Add desired file/directory into
compose.yamlto mount inside the container
services:
mariadb:
...
volumes:
- db_data:/var/lib/mysql
- ./your-sql-file.sql:/docker-entrypoint-initdb.d/init.sql- Recreate the contianer and access the SQL console
docker compose up -d
docker exec -it mariadb-container mariadb -D database -u root -prootpassword- You may now recreate the container or source the file inside the SQL console
-- run inside mariadb container
source /docker-entrypoint-initdb.d/init.sqlHave you done something fatal to the database instance, you can always reset the container persistent storage via
docker compose down
docker volume rm cw_db_data