Exploring Docker Networking: with example

Atul  telelAtul telel
2 min read

🐳 Docker Networking Explained : -

A network is simply a group of two or more devices that can talk to each other, The Docker network is a virtual network created by Docker to enable communication between Docker containers. there's something called a Docker network. If you have two containers on the same machine, they can connect with each other right out of the box, no need to set up special ports or anything.

🐳 Types of Docker Network Drivers :-

Command to see the list of containers :-

🔹 1. bridge: - The default driver if you don’t specify one, Creates a private internal network on the host.

🔹 2. host : - The container shares the host’s network stack, No isolation between host and container networking.

🔹 3. none : - No network connection at all,Completely isolated unless connected manually later.

🔹 4. overlay : - Enables communication between containers on different Docker hosts, Requires Docker Swarm or Kubernetes.

🔹 5. macvlan : - Assigns a MAC address to the container, making it look like a physical device on the LAN, Containers get IPs directly from your network’s subnet.

Example : -

🔹 Step 1: Create a Docker Network : -

🔹 Step 2: Run the MySQL Container : -

🔹 Step 3: Run the Application Container : -

Output : -

1
Subscribe to my newsletter

Read articles from Atul telel directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Atul  telel
Atul telel