How to import MySQL Dump into Docker container?

Suppose you have mysqld dump of your old database, now you want to migrate your infrastructure to docker containers. To import that dump, do following steps:

  1. write docker-compose.yml like this

2. create new folder name it data: mkdir data and copy your dump.sqlfile to data directory.
3. enter docker-compose up and wait for container to import the database.
4. final database is imported to MySQL directory.