More secure mysqldump for docker container
In case you have warning message about insecure user and password usage from command line you can do following:
- use mysql_config_editor set
login-path=localhost=localhostuser=db_userpassword executed in container via exec. That will create encrypted file. - Specify --login-path=local instead of -u user and -p password in your backup script.
I have my backups via rsnapshot. This is something like TimeMachine for Mac with handy directory structure and without duplication.
And my backup script looks like this:
/usr/bin/ssh -i /mnt/HD/HD_a2/ffp/home/root/id_rsa_nexus.key -C core@myipaddress "docker exec itservice_db_1 mysqldump --login-path=local itservice_production" >
mysqlbackup.sql
That will create mysql dump on your remote backup host without passing user and password in more secure way.
docker-compose exec db mysql_config_editor set --login_path=local --host=localhost --user=itservice --password
will ask password and save credentials in container.