0
0
Dockerdevops~30 mins

Creating custom bridge networks in Docker - Try It Yourself

Choose your learning style9 modes available
Creating custom bridge networks
📖 Scenario: You are setting up Docker containers for a small app. To keep the containers organized and isolated, you want to create a custom bridge network. This helps containers communicate easily and keeps them separate from other Docker networks.
🎯 Goal: Create a custom Docker bridge network named my_custom_network. Then, run a container attached to this network and finally list all Docker networks to confirm your custom network is created.
📋 What You'll Learn
Create a Docker bridge network named my_custom_network
Run a Docker container named my_nginx using the nginx image attached to my_custom_network
List all Docker networks to verify my_custom_network exists
💡 Why This Matters
🌍 Real World
Custom Docker networks help isolate and organize containers in real projects, improving security and communication.
💼 Career
Understanding Docker networking is essential for DevOps roles managing containerized applications and infrastructure.
Progress0 / 4 steps
1
Create a custom Docker bridge network
Use the docker network create command to create a bridge network named my_custom_network.
Docker
Need a hint?

Use docker network create --driver bridge my_custom_network to create the network.

2
Run a container attached to the custom network
Run a Docker container named my_nginx using the nginx image. Attach it to the my_custom_network network using the --network option.
Docker
Need a hint?

Use docker run -d --name my_nginx --network my_custom_network nginx to start the container.

3
List all Docker networks
Use the docker network ls command to list all Docker networks and confirm that my_custom_network is listed.
Docker
Need a hint?

Simply run docker network ls to see all networks.

4
Display the custom network details
Use the docker network inspect command with my_custom_network to display detailed information about your custom network.
Docker
Need a hint?

Run docker network inspect my_custom_network to see the network details including connected containers.