Connect MySQL and phpMyAdmin Using Docker | Docker Network Explained

Learn how to create Docker Network and connect containers.

Bharathiraja
CodeX

--

Docker Network

Previously we have seen how to install Docker and how to run the Docker container?. Docker runs the containers in an isolated environment. If the containers are running in an isolated mode, then how we can connect one container with another container?. Say, for example, assume we are running a MySQL container. Now we want to access the MySQL container using phpMyAdmin, then we need the host IP address and running port. However if the phpMyAdmin also runs in a Docker container, then the phpMyAdmin can easily communicate with MySQL using the Docker Network.

Yes, we can use the Docker network to connect multiple containers. The process is very simple. Just create a new docker network using the docker create network command. And attach the newly created network to the container using the — net option. Docker network is designed to ease the communication between docker containers.

In this tutorial, I am going to show the demo of the Docker network using MySQL and phpMyAdmin. You can use the same procedure to connect any container.

1. Create Docker Network:

--

--

Bharathiraja
CodeX
Writer for

AWS | DevOps | Kubernetes | Terraform| Angular | Deep&Machine Learning, Ionic, Full Stack Developer. Learn more at https://github.com/bharathirajatut