nerdexam
Docker

DCA · Question #98

The following Docker Compose file is deployed as a stack: Is this statement correct about this health check definition? Solution: Health checks test for app health ten seconds apart. If the test fails

The correct answer is B. No. This statement incorrectly describes the behavior of Docker Compose health checks regarding container restarts.

Submitted by salim_om· Apr 18, 2026Container Orchestration

Question

The following Docker Compose file is deployed as a stack:

Is this statement correct about this health check definition? Solution: Health checks test for app health ten seconds apart. If the test fails, the container will be restarted three times before it gets rescheduled.

Options

  • AYes
  • BNo

How the community answered

(14 responses)
  • A
    29% (4)
  • B
    71% (10)

Why each option

This statement incorrectly describes the behavior of Docker Compose health checks regarding container restarts.

AYes

The `retries` parameter dictates how many failures lead to an unhealthy state, not how many times a container is automatically restarted by the health check mechanism.

BNoCorrect

Docker Compose health checks with `retries: 3` define how many consecutive failures lead to an 'unhealthy' status, but they do not inherently trigger container restarts. Restarting a container upon health check failure requires a separate `restart_policy` configuration for the service.

Concept tested: Docker Compose health check vs. restart policy

Source: https://docs.docker.com/compose/compose-file/05-services/#healthcheck

Topics

#Docker Compose#Health Check#Service Monitoring#Container Orchestration

Community Discussion

No community discussion yet for this question.

Full DCA Practice