docker run —name some-name -p 3306:3306 -e MYSQL_ROOT_PASSWORD=some_pass-d MySQL
here,
p
→ ports (host_port:container_port, containers in the same network use container_port to communicate and host_port is used to access it from outside the network)e
→ envd
→ for running the container in the background, and MySQL is the image name without any tag which means the latest MySQL image will be downloaded from the dockerhub.Now, we can use MySQL workbench or any other MySQL client to create the database and the tables.
https://stackoverflow.com/questions/29145370/how-can-i-initialize-a-mysql-database-with-schema-in-a-docker-container