docker exec -i mysql_container mysqldump -uroot -proot --databases database_name --skip-comments > /path/to/my/dump.sql- This will generate a
dump.sqlfile in your host machine. Awesome, eh? - Avoid using
--compacton your dump. This will make MySQL check your constraints which will cause troubles when reading your file (damm you MySQL). And don't use--forceto fix this scenario: recreate your dump without--compact¯_(ツ)_/¯