docker exec [CONTAINER] /usr/bin/mysqldump -u[user] -p[password] [DATABASE] > backup.sql
cat backup.sql | docker exec -i [CONTAINER] /usr/bin/mysql -u[user] -p[password] [DATABASE]
Note: Container in this case can be either part or the full container id or the full container name.