O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it…

Execute the docker run command to create and run a MySQL Docker container from the mysql:latest image, assigning the container name as mysql-container using the --name flag, as follows:

$ docker run --net=my-bridge-network -p 3306:3306 --name mysql-container -e MYSQL_ROOT_PASSWORD=my-pass -d mysql:latest c3ca3e6f253efa40b1e691023155ab3f37eb07b767b1744266ac4ae85fca1722

The --net flag specified in the docker run command connects mysql-container to my-bridge-network. The -p flag specified in the docker run command publishes the container's 3306 port to the host 3306 port. The -e flag specified in the docker run command sets the MYSQL_ROOT_PASSWORD value as my-pass, which is an environment variable of the mysql:latest image. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required