Add the following to your docker-compose.yml file:
backup:
image: yappabe/mysql-backup
links:
- mysql
environment:
DBS: db1
MYSQL_USERNAME: mysqlusername
MYSQL_PASSWORD: mysqlpassword
MYSQL_HOST: mysql
RSYNC_COMMAND: "rsync -avz -e \"ssh -p 2122 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" %DIR%/* user@host:/backup_path"
CRON_TIME: "0 17 * * *"
NOTIFICATION_SERVICE: slack
SLACK_HOOK_URL: "https://hooks.slack.com/services/XXXXXXX/XXXXXXX/XXXXXXXXXXXXXX"
SLACK_CHANNEL: "#general"
SLACK_USERNAME: "container-mysql-backup"
SLACK_EMOJI: "package"
You can generate/add or mount a private key:
volumes:
- ~/.ssh/id_rsa:/root/.ssh/id_rsa