Running a MySQL Docker image on a user-defined bridge network

Whenever we run a Docker image to create and boot up a container, it uses the default bridge network, which Docker creates during installation. To run an image on a specific network, which may be either user-defined or one of the other two networks that Docker creates automatically, host or none, we have to provide the additional --net flag with the value as the network name as part of the docker run command.

In this recipe, we will run a MySQL image on the user-defined bridge network that we created in the previous recipe, passing the --net flag value as my-bridge-network.

Get Go Web Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.