Let’s Start Creating Docker Seeding
Hope you are familiar with “Docker-Compose”
├── docker-compose.yml (File)
├── init (Directory)
|-- 01.sql (File)
Create a new file docker-compose.yml
Above file, we have created a MySql Docker container default Port No: 3306
As well as set environment variables such as user, password of MySql container.
if you check the entire file we have also created volumes that point to the `./init:` directory
The script inside `/init` is “01.sql” file which creates a new table student and inserts the records upon container startup
When you run the following command in the root directory for the project.
then you will see in the console running /docker-entrypoint-initdb.d/01.sql script will be executed as the following screenshot