You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
529 B

# docker-compose.yml file
version: '3.8'
services:
db:
image: mariadb:latest
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- ./data:/var/lib/mysql
- ./backups:/backups
ports:
- "3306:3306"
command: >
bash -c "while true; do
mysqldump -u root -p${MYSQL_ROOT_PASSWORD} --all-databases | gzip > /backups/db_$(date +%Y%m%d%H%M%S).sql.gz;
sleep 24h;
done"