Overlay networks in Docker Swarm allow containers to communicate across different hosts. What is the main reason to use an overlay network?
Think about how containers on different machines can talk to each other.
Overlay networks connect containers running on different Docker hosts in a Swarm, enabling them to communicate as if they were on the same network.
What is the expected output after running the command to create an overlay network named mynet in Docker Swarm?
docker network create --driver overlay mynetDocker usually returns the network ID or name after creation.
The command returns the network ID or name (here, the name 'mynet') to confirm creation.
Which Docker Compose snippet correctly defines a service that uses an overlay network named mynet in a Swarm stack?
version: '3.8'
services:
web:
image: nginx
networks:
- mynet
networks:
mynet:
driver: overlayOverlay networks require the driver to be set to 'overlay' under networks.
Option A correctly defines the overlay network and attaches the service to it. Other options use wrong drivers or incorrect keys.
You created an overlay network and deployed services in Docker Swarm, but containers on different nodes cannot communicate. What is a likely cause?
Overlay networks require certain ports open between nodes.
Overlay networks need nodes to communicate over specific ports (like 4789 UDP). If firewalls block these, communication fails.
Arrange the steps in the correct order to deploy a multi-service application using an overlay network in Docker Swarm.
Think about setting up the cluster before creating networks and deploying services.
First initialize Swarm, then add workers, create overlay network, then deploy services using it.