Container networking is the way containers communicate with each other and with the outside world using network connections.
Click to reveal answer
beginner
Name a common network model used by containers to communicate within the same host.
The bridge network model is commonly used for containers to communicate within the same host by connecting them to a virtual bridge.
Click to reveal answer
beginner
What is the purpose of port mapping in container networking?
Port mapping connects a port on the host machine to a port inside the container, allowing external access to container services.
Click to reveal answer
intermediate
Explain the difference between 'host' and 'bridge' network modes in containers.
In 'host' mode, containers share the host's network stack directly, while in 'bridge' mode, containers get their own network namespace connected via a virtual bridge.
Click to reveal answer
intermediate
What role do container network interfaces (CNIs) play?
CNIs are plugins that configure network interfaces for containers, enabling them to connect to different network types and manage IP addresses.
Click to reveal answer
Which network mode allows a container to use the host's network directly?
AHost mode
BOverlay mode
CBridge mode
DNone mode
✗ Incorrect
Host mode lets containers share the host's network stack directly.
What does port mapping in container networking do?
AConnects containers to each other
BMaps container ports to host ports for external access
CCreates a virtual network bridge
DAssigns IP addresses to containers
✗ Incorrect
Port mapping links a container's port to a host port so outside users can access container services.
Which plugin type is used to manage container network interfaces?
What is the main purpose of the bridge network in container environments?
ATo isolate containers from each other
BTo provide internet access to containers
CTo connect containers across different hosts
DTo connect containers on the same host
✗ Incorrect
Bridge networks connect containers on the same host so they can communicate.
Overlay networks in container networking are mainly used to:
AConnect containers across multiple hosts
BConnect containers on the same host
CAssign IP addresses to containers
DMap ports from host to container
✗ Incorrect
Overlay networks allow containers on different hosts to communicate securely.
Describe how containers communicate within the same host and how port mapping helps external access.
Think about virtual bridges and how outside users reach container apps.
You got /4 concepts.
Explain the difference between host network mode and bridge network mode in container networking.
Consider how containers share or separate network resources.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of container networking?
easy
A. To manage container CPU usage
B. To allow containers to communicate and share data
C. To store container images
D. To create user accounts inside containers
Solution
Step 1: Understand container networking basics
Container networking connects containers so they can communicate and share data or services.
Step 2: Identify the main purpose
Other options relate to storage, CPU, or user management, which are not networking functions.
Final Answer:
To allow containers to communicate and share data -> Option B
Quick Check:
Container networking = communication and data sharing [OK]
Hint: Networking means connecting containers to talk [OK]
Common Mistakes:
Confusing networking with storage or CPU management
Thinking networking creates user accounts
Assuming networking manages container images
2. Which of the following is a default network type used in container platforms like Docker?
easy
A. Bridge network
B. Cloud network
C. VPN network
D. Overlay network
Solution
Step 1: Recall default network types in container platforms
Docker and similar platforms use bridge, host, and none as default network types.
Step 2: Identify the correct default network
Bridge network is the common default for container communication on a single host.
Final Answer:
Bridge network -> Option A
Quick Check:
Default network in Docker = Bridge [OK]
Hint: Bridge is the default container network type [OK]
Common Mistakes:
Confusing overlay with default (overlay is user-defined)
Thinking VPN or cloud networks are default
Mixing host network with VPN
3. Consider the following Docker command: docker network create --driver overlay my_overlay. What is the main use of this network?
medium
A. Create a network for host-only communication
B. Connect containers on the same host only
C. Isolate containers from all networks
D. Connect containers across multiple hosts
Solution
Step 1: Understand the overlay network driver
Overlay networks allow containers on different hosts to communicate securely.
Step 2: Analyze the command purpose
The command creates an overlay network named 'my_overlay' for multi-host container communication.
Final Answer:
Connect containers across multiple hosts -> Option D
Quick Check:
Overlay network = multi-host container communication [OK]
Hint: Overlay networks span multiple hosts [OK]
Common Mistakes:
Assuming overlay works only on one host
Confusing overlay with bridge network
Thinking overlay isolates containers
4. A user tries to connect two containers on different hosts using a bridge network but fails. What is the likely cause?
medium
A. Containers must be on the same host to use overlay networks
B. Host network driver is required for multi-host
C. Bridge networks do not support multi-host communication
D. Containers need different IP addresses to communicate
Solution
Step 1: Understand bridge network limitations
Bridge networks only connect containers on the same host.
Step 2: Identify the cause of failure
Trying to connect containers on different hosts with bridge network fails because it doesn't support multi-host communication.
Final Answer:
Bridge networks do not support multi-host communication -> Option C
Quick Check:
Bridge network = single host only [OK]
Hint: Bridge = single host only, use overlay for multi-host [OK]
Common Mistakes:
Thinking overlay networks require same host
Believing host network driver enables multi-host
Assuming IP address difference causes failure
5. You want to securely connect multiple containers running on different hosts in a cluster, ensuring encrypted communication and easy scaling. Which container network type should you choose?
hard
A. Overlay network
B. Bridge network
C. Host network
D. None network
Solution
Step 1: Analyze requirements for multi-host secure communication
Connecting containers across hosts with encryption and scalability needs overlay networks.
Step 2: Compare network types
Host network shares host's network stack (no isolation), bridge is single host only, none disables networking.
Step 3: Confirm overlay network features
Overlay networks provide encrypted, scalable multi-host container communication.
Final Answer:
Overlay network -> Option A
Quick Check:
Secure multi-host container communication = Overlay network [OK]