You can also take dump using this single command
docker exec database-container-id mysqldump -u username -ptestpassword --no-tablespaces --single-transaction --quick databasename > Database-backup-$(date +%Y%m%d-%H%M%S).sql