Running a web application Docker container linked with a MySQL Docker container on a user-defined bridge network
In this recipe, we will learn how to run a Go web application Docker image to create a container which will communicate with the MYSQL database instance running in a separate Docker container.
As we know Docker does not support automatic service discovery on the default bridge network, we will be using the user-defined network that we created in one of our previous recipes to run a Go web application Docker image.
How to do it…
Execute the docker run
command to create a web application Docker container from the web-application-image
, assigning the container name as web-application-container
using the --name
flag, as follows:
$ docker run --net=my-bridge-network -p 8090:8080 --name web-application-container -d web-application-image ef9c73396e9f9e04c94b7327e8f02cf57ce5f0cd674791e2805c86c70e5b9564
The --net
flag specified in the docker run
command connects the mysql-container
to the...