I need to dump databases just infrequently enought that I have not memorized the correct commands yet.

PostgreSQL

Export

docker exec -t DB_CONTAINER_NAME pg_dumpall -c -U postgres > dump.sql

Import

cat dump.sql | docker exec -i DB_CONTAINER_NAME psql -U postgres

MySQL

Export

docker exec DB_CONTAINER_NAME /usr/bin/mysqldump -u root --password=PASSWORD DATABASE > backup.sql

Import

cat backup.sql | docker exec -i DB_CONTAINER_NAME /usr/bin/mysql -u root --password=PASSWORD DATABASE