Bird
0
0

In a production Docker Swarm, how can you ensure your service stays running even if a node fails?

hard📝 Best Practice Q15 of 15
Docker - Production Patterns
In a production Docker Swarm, how can you ensure your service stays running even if a node fails?
AUse 'docker container run' repeatedly on the same node
BRun the service with a single replica on one node only
CSet the service replicas to more than one so tasks run on multiple nodes
DDisable swarm mode to avoid node failures
Step-by-Step Solution
Solution:
  1. Step 1: Understand high availability in swarm

    Running multiple replicas spreads tasks across nodes, so if one node fails, others keep running the service.
  2. Step 2: Evaluate options

    Single replica or running containers manually does not provide failover. Disabling swarm removes orchestration benefits.
  3. Final Answer:

    Set the service replicas to more than one so tasks run on multiple nodes -> Option C
  4. Quick Check:

    Multiple replicas = high availability [OK]
Quick Trick: Use multiple replicas for failover in swarm [OK]
Common Mistakes:
  • Running only one replica expecting failover
  • Manually running containers without orchestration
  • Disabling swarm mode to fix node failures

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes