0
0
Dockerdevops~20 mins

Overlay networks in Swarm in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Overlay Network Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary purpose of an overlay network in Docker Swarm?

Overlay networks in Docker Swarm allow containers to communicate across different hosts. What is the main reason to use an overlay network?

ATo enable communication between containers on different Docker hosts within the same Swarm cluster
BTo isolate containers on the same host from each other
CTo speed up container startup time on a single host
DTo provide persistent storage for containers
Attempts:
2 left
💡 Hint

Think about how containers on different machines can talk to each other.

💻 Command Output
intermediate
1:00remaining
Output of creating an overlay network in Docker Swarm

What is the expected output after running the command to create an overlay network named mynet in Docker Swarm?

Docker
docker network create --driver overlay mynet
ANetwork mynet created successfully
BError: network driver not found
Ca long JSON output describing the network
Dmynet
Attempts:
2 left
💡 Hint

Docker usually returns the network ID or name after creation.

Configuration
advanced
2:30remaining
Correct Docker Compose snippet for using overlay network in Swarm

Which Docker Compose snippet correctly defines a service that uses an overlay network named mynet in a Swarm stack?

Docker
version: '3.8'
services:
  web:
    image: nginx
    networks:
      - mynet
networks:
  mynet:
    driver: overlay
A
version: '3.8'
services:
  web:
    image: nginx
    networks:
      - mynet
networks:
  mynet:
    driver: overlay
B
version: '3.8'
services:
  web:
    image: nginx
    networks:
      - mynet
networks:
  mynet:
    driver: bridge
C
version: '3.8'
services:
  web:
    image: nginx
    network_mode: overlay
networks:
  mynet:
    driver: overlay
D
version: '3.8'
services:
  web:
    image: nginx
    networks:
      - mynet
networks:
  mynet:
    driver: host
Attempts:
2 left
💡 Hint

Overlay networks require the driver to be set to 'overlay' under networks.

Troubleshoot
advanced
2:00remaining
Why does a container fail to communicate over an overlay network?

You created an overlay network and deployed services in Docker Swarm, but containers on different nodes cannot communicate. What is a likely cause?

AThe overlay network was created with the bridge driver
BThe containers are using the host network driver instead of overlay
CThe Docker Swarm nodes are not connected via a VPN or have blocked required ports
DThe containers are running on the same node
Attempts:
2 left
💡 Hint

Overlay networks require certain ports open between nodes.

🔀 Workflow
expert
3:00remaining
Correct sequence to deploy a multi-service app using overlay network in Swarm

Arrange the steps in the correct order to deploy a multi-service application using an overlay network in Docker Swarm.

A2,1,4,3
B1,4,2,3
C1,2,4,3
D4,1,2,3
Attempts:
2 left
💡 Hint

Think about setting up the cluster before creating networks and deploying services.