A custom bridge network is a user-defined network that allows Docker containers to communicate with each other on the same host with isolated network settings.
Click to reveal answer
beginner
Which Docker command creates a custom bridge network named 'my_bridge'?
docker network create --driver bridge my_bridge
Click to reveal answer
intermediate
Why use a custom bridge network instead of the default bridge network?
Custom bridge networks provide better isolation, allow container name resolution, and enable easier management of container communication.
Click to reveal answer
beginner
How do containers communicate on a custom bridge network?
Containers on the same custom bridge network can communicate using container names as hostnames, simplifying service discovery.
Click to reveal answer
intermediate
What happens if you try to connect a container to a non-existent custom bridge network?
Docker will return an error saying the network does not exist, and the container will not start or connect until the network is created.
Click to reveal answer
Which command creates a custom bridge network in Docker?
Adocker create network bridge my_network
Bdocker network create --driver bridge my_network
Cdocker network new bridge my_network
Ddocker bridge create my_network
✗ Incorrect
The correct syntax to create a custom bridge network is 'docker network create --driver bridge '.
What is the default driver used when creating a custom bridge network?
Anone
Boverlay
Chost
Dbridge
✗ Incorrect
The 'bridge' driver is the default for custom bridge networks in Docker.
How can containers on a custom bridge network communicate with each other?
AOnly through published ports
BUsing container IP addresses only
CUsing container names as hostnames
DThey cannot communicate
✗ Incorrect
Containers on the same custom bridge network can use container names as hostnames to communicate.
What command lists all Docker networks including custom bridge networks?
Adocker network ls
Bdocker network show
Cdocker network list all
Ddocker networks
✗ Incorrect
'docker network ls' lists all Docker networks on the host.
What happens if you remove a custom bridge network while containers are connected to it?
AContainers lose network connectivity and may stop
BDocker automatically reconnects containers to default network
CNothing happens
DContainers keep running and stay connected
✗ Incorrect
Removing a custom bridge network disconnects containers, causing network loss and possible container failure.
Explain how to create and use a custom bridge network in Docker.
Think about the command to create the network and how containers talk to each other on it.
You got /4 concepts.
Describe the benefits of using a custom bridge network over the default Docker bridge network.
Consider what problems the default network might have that a custom one solves.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of creating a custom bridge network in Docker?
easy
A. To increase the CPU usage of containers
B. To allow containers to communicate privately and securely
C. To automatically update container images
D. To create a backup of container data
Solution
Step 1: Understand Docker networking basics
Docker uses networks to connect containers. The default bridge network is shared and less secure.
Step 2: Purpose of custom bridge networks
Custom bridge networks isolate containers, allowing private and secure communication between them.
Final Answer:
To allow containers to communicate privately and securely -> Option B
Quick Check:
Custom bridge network = private container communication [OK]
Hint: Custom bridge = private container communication [OK]
Common Mistakes:
Thinking custom bridge increases CPU usage
Confusing network creation with image updates
Assuming it creates data backups
2. Which of the following is the correct command to create a custom bridge network named my_bridge?
easy
A. docker network create --driver bridge my_bridge
B. docker create network bridge my_bridge
C. docker network new --type bridge my_bridge
D. docker bridge create network my_bridge
Solution
Step 1: Recall Docker network creation syntax
The correct syntax is docker network create --driver bridge NETWORK_NAME.
Step 2: Match the command with the syntax
docker network create --driver bridge my_bridge matches the correct syntax exactly for creating a bridge network named my_bridge.
Final Answer:
docker network create --driver bridge my_bridge -> Option A
Hint: Use 'docker network create --driver bridge NAME' [OK]
Common Mistakes:
Using wrong command order
Missing --driver flag
Using 'new' or 'create' incorrectly
3. Given the command docker network create --driver bridge isolated_net, what will be the output of docker network ls related to this network?
medium
A. No change; the network list remains the same
B. An error message saying 'driver not found' will appear
C. The default bridge network will be removed
D. A new network named 'isolated_net' with driver 'bridge' will appear in the list
Solution
Step 1: Understand the effect of the create command
The command creates a new bridge network named 'isolated_net'.
Step 2: Check the network list after creation
Running docker network ls shows all networks including the newly created 'isolated_net' with driver 'bridge'.
Final Answer:
A new network named 'isolated_net' with driver 'bridge' will appear in the list -> Option D
Quick Check:
New bridge network appears in list [OK]
Hint: New bridge network shows in 'docker network ls' [OK]
Common Mistakes:
Expecting an error for valid driver
Thinking default bridge is removed
Assuming no change in network list
4. You ran docker network create --driver bridge without specifying a network name. What is the likely result?
medium
A. Docker creates a network named 'bridge' by default
B. Docker creates a network with a random generated name
C. Docker throws an error about missing network name
D. Docker creates the default bridge network again
Solution
Step 1: Check required arguments for network creation
The docker network create command requires a network name after options.
Step 2: Result of missing network name
Omitting the network name causes Docker to throw an error indicating the missing argument.
Final Answer:
Docker throws an error about missing network name -> Option C
Quick Check:
Missing name causes error [OK]
Hint: Always specify network name after options [OK]
Common Mistakes:
Assuming Docker auto-generates network name
Thinking 'bridge' is default name created
Confusing with default bridge network
5. You want two containers to communicate only with each other and not with other containers on the host. Which steps correctly create and use a custom bridge network named private_net?
hard
A. Create network with docker network create --driver bridge private_net and run containers with --network private_net
B. Run containers with --link option without creating a network
C. Use default bridge network and assign static IPs manually
D. Create network with docker network create private_net without specifying driver
Solution
Step 1: Create a custom bridge network
Use docker network create --driver bridge private_net to create an isolated network.
Step 2: Run containers attached to this network
Start containers with --network private_net so they communicate only within this network.
Final Answer:
Create network with 'docker network create --driver bridge private_net' and run containers with '--network private_net' -> Option A
Quick Check:
Custom bridge + --network = isolated container communication [OK]
Hint: Create bridge network then run containers with --network [OK]
Common Mistakes:
Using --link which is deprecated
Relying on default bridge for isolation
Omitting --driver option causing default driver
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.