🎯 Objective
Create a custom Docker network named media on App Server 3 in Stratos DC with:
Network Name → media
Driver → bridge
Subnet → 10.10.1.0/24
IP Range → 10.10.1.0/24The main command is:
docker network create \
--driver bridge \
--subnet 10.10.1.0/24 \
--ip-range 10.10.1.0/24 \
media🧠 Concept
A Docker network allows containers to communicate with each other and with external networks.
Docker provides several network drivers, including:
bridge
host
none
overlay
macvlan
ipvlanFor this task, we use:
bridgeA custom bridge network provides an isolated network for containers running on the same Docker host.
Docker Host
│
▼
┌─────────────────────────────┐
│ media │
│ Driver: bridge │
│ Subnet: 10.10.1.0/24 │
│ │
│ Container A │
│ ↕ │
│ Container B │
└─────────────────────────────┘🌉 What Is a Bridge Network?
The bridge driver creates a private network inside the Docker host.
Containers connected to the same custom bridge network can communicate with each other.
For example:
Docker Host
│
┌─────────┴─────────┐
│ │
│ media network │
│ 10.10.1.0/24 │
│ │
│ ┌───────────┐ │
│ │Container A│ │
│ └─────┬─────┘ │
│ ↕ │
│ ┌───────────┐ │
│ │Container B│ │
│ └───────────┘ │
│ │
└───────────────────┘Custom bridge networks also provide useful features such as container-name DNS resolution between containers on the same network.
🔍 Step 1: Check Existing Docker Networks
List the existing Docker networks:
docker network lsTypical output:
NETWORK ID NAME DRIVER SCOPE
xxxxxxxxxxxx bridge bridge local
xxxxxxxxxxxx host host local
xxxxxxxxxxxx none null localDocker normally creates these default networks automatically:
bridge
host
none🚀 Step 2: Create the media Network
Create the required network:
docker network create \
--driver bridge \
--subnet 10.10.1.0/24 \
--ip-range 10.10.1.0/24 \
mediaIf Docker requires elevated privileges:
sudo docker network create \
--driver bridge \
--subnet 10.10.1.0/24 \
--ip-range 10.10.1.0/24 \
media🧩 Command Breakdown
Network Create
docker network createCreates a new Docker network.
Driver
--driver bridgeSpecifies that the network should use the:
bridgedriver.
Short form:
-d bridgeSubnet
--subnet 10.10.1.0/24Defines the network's address space.
The CIDR:
10.10.1.0/24represents the subnet used by the Docker network.
Conceptually:
media
│
└── Subnet
└── 10.10.1.0/24Docker allocates container addresses from the configured network according to its IPAM configuration.
IP Range
--ip-range 10.10.1.0/24Specifies the range Docker can use when dynamically assigning IP addresses to containers.
For this task:
Subnet → 10.10.1.0/24
IP Range → 10.10.1.0/24The IP range covers the same CIDR block as the configured subnet.
Network Name
The final argument:
mediasets the network name to:
media🔍 Step 3: Verify the Network
List Docker networks again:
docker network lsYou should now see:
NETWORK ID NAME DRIVER SCOPE
xxxxxxxxxxxx bridge bridge local
xxxxxxxxxxxx host host local
xxxxxxxxxxxx media bridge local
xxxxxxxxxxxx none null localThe important entry is:
media bridge🔬 Step 4: Inspect the Network
For detailed information, run:
docker network inspect mediaLook for the IPAM configuration.
You should see information equivalent to:
"IPAM": {
"Config": [
{
"Subnet": "10.10.1.0/24",
"IPRange": "10.10.1.0/24"
}
]
}This verifies:
Name → media ✅
Driver → bridge ✅
Subnet → 10.10.1.0/24 ✅
IP Range → 10.10.1.0/24 ✅🧠 Docker IPAM
Docker uses IP Address Management (IPAM) to manage addresses assigned to containers.
For this network:
media
│
▼
Docker IPAM
│
├── Subnet
│ └── 10.10.1.0/24
│
└── IP Range
└── 10.10.1.0/24When containers join the network, Docker can automatically allocate addresses from the configured range.
🐳 Optional: Connect a Container
A container can be created directly on the network:
docker run -d \
--name app1 \
--network media \
nginxThe architecture becomes:
Docker Host
│
▼
media
10.10.1.0/24
│
▼
app1Inspect the container:
docker inspect app1Or inspect the network again:
docker network inspect mediaThe connected container should appear under:
Containers🔗 Optional: Connect Existing Container
An already-running container can also be attached to the network:
docker network connect media <container_name>For example:
docker network connect media app1To disconnect it:
docker network disconnect media app1🗑️ Optional: Remove the Network
If the network is no longer required:
docker network rm mediaDocker normally requires containers to be disconnected from the network before the network can be removed.
⚠️ Important Notes
⚙️ Complete Workflow
Check existing networks:
docker network lsCreate the network:
docker network create \
--driver bridge \
--subnet 10.10.1.0/24 \
--ip-range 10.10.1.0/24 \
mediaVerify:
docker network lsInspect:
docker network inspect media🧪 Validation Checklist
📌 Summary
The complete command is:
docker network create \
--driver bridge \
--subnet 10.10.1.0/24 \
--ip-range 10.10.1.0/24 \
mediaVerify it:
docker network inspect mediaThe final configuration is:
Docker Host — App Server 3
│
▼
┌────────────────────────────┐
│ Network: media │
│ │
│ Driver → bridge │
│ Subnet → 10.10.1.0/24 │
│ IP Range → 10.10.1.0/24 │
│ │
│ Containers │
│ ↕ ↕ │
│ ↔ ↔ │
└────────────────────────────┘The key takeaway is:
> A custom Docker bridge network provides an isolated network where containers can communicate with each other while Docker IPAM manages container addresses within the configured subnet and IP range.