Bird
0
0

You scaled a service to 4 replicas but one replica keeps restarting due to an error. How can you update the service to limit replicas to only healthy containers?

hard📝 Workflow Q9 of 15
Docker - Swarm
You scaled a service to 4 replicas but one replica keeps restarting due to an error. How can you update the service to limit replicas to only healthy containers?
ARemove the service and recreate it with 3 replicas
BManually stop the failing container and scale down to 3 replicas
CUse health checks and update the service to restart only healthy replicas
DUse 'docker service scale servicename=3' to ignore unhealthy replicas
Step-by-Step Solution
Solution:
  1. Step 1: Understand health checks in Docker services

    Health checks allow Docker to monitor container health and restart unhealthy ones.
  2. Step 2: Use health checks to manage replicas

    Updating the service with health checks ensures only healthy replicas run and unhealthy ones restart automatically.
  3. Final Answer:

    Use health checks and update the service to restart only healthy replicas -> Option C
  4. Quick Check:

    Health checks manage replica health automatically [OK]
Quick Trick: Use health checks to manage replica health [OK]
Common Mistakes:
  • Manually stopping containers instead of using health checks
  • Removing and recreating service unnecessarily
  • Scaling down without fixing health issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes