Export and import db from a docker container.

This is how to make a export and import of a docker container db

# Backup
  docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
   
  # Restore
  cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

Posted on: Sunday 25 March 2018