Dump your DB running in a Docker container using the native MariaDB/MySQL mysqldump command docker exec <container> \ mysqldump \ --user=<username> \ --password=<password> \ --single-transaction \ <db_name> | gzip > <dump_name>.sql.gz docker-compose exec <container> \ mysqldump \ --user=<username> \ --password=<password> \ --single-transaction \ <db_name> | gzip > <dump_name>.sql.gz Import the dump file into your DB running in a Docker container using the native MariaDB/MySQL mysql command zcat <dump_name>.sql.gz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | docker exec -i <container> \ mysql \ --user=<username> \ --password=<password> \ <db_name> zcat <dump_name>.sql.gz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | docker-compose exec -T <container> \ mysql \ --user=<username> \ --password=<password> \ <db_name>