Bird
0
0

Which Dockerfile instruction correctly defines a health check that runs every 30 seconds?

easy📝 Syntax Q3 of 15
Docker - Logging and Monitoring
Which Dockerfile instruction correctly defines a health check that runs every 30 seconds?
AHEALTHCHECK CMD --interval=30s curl -f http://localhost/ || exit 1
BHEALTHCHECK CMD curl -f http://localhost/ || exit 1 --interval=30s
CHEALTHCHECK --interval=30s CMD curl -f http://localhost/ || exit 1
DHEALTHCHECK INTERVAL 30 CMD curl -f http://localhost/ || exit 1
Step-by-Step Solution
Solution:
  1. Step 1: Understand HEALTHCHECK syntax

    The correct syntax places options like --interval before CMD.
  2. Step 2: Identify correct placement

    HEALTHCHECK --interval=30s CMD curl -f http://localhost/ || exit 1 correctly uses --interval=30s before CMD.
  3. Final Answer:

    HEALTHCHECK --interval=30s CMD curl -f http://localhost/ || exit 1 -> Option C
  4. Quick Check:

    HEALTHCHECK --interval=30s CMD curl -f http://localhost/ || exit 1 syntax matches Dockerfile HEALTHCHECK format [OK]
Quick Trick: Options like --interval go before CMD in HEALTHCHECK [OK]
Common Mistakes:
  • Placing options after CMD
  • Using incorrect keywords like INTERVAL instead of --interval
  • Misordering the command parts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes