0
0
Dockerdevops~10 mins

Alert setup for container health in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Docker healthcheck command to check if the container is healthy.

Docker
HEALTHCHECK CMD curl -f http://localhost[1] || exit 1
Drag options to blanks, or click blank then click option'
A:80/health
B:8080/health
C:443/health
D:3000/health
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong port number
Missing colon before port
Incorrect endpoint path
2fill in blank
medium

Complete the Docker Compose healthcheck interval setting to run every 30 seconds.

Docker
healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost/health"]
  interval: [1]
Drag options to blanks, or click blank then click option'
A10s
B30s
C1m
D5s
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong time format
Too short or too long interval
Missing 's' suffix
3fill in blank
hard

Fix the error in the healthcheck test command to correctly check container health.

Docker
healthcheck:
  test: [1]
Drag options to blanks, or click blank then click option'
A"CMD curl -f http://localhost/health"
B"curl -f http://localhost/health"
C["curl", "-f", "http://localhost/health"]
D["CMD", "curl", "-f", "http://localhost/health"]
Attempts:
3 left
💡 Hint
Common Mistakes
Using string instead of array
Missing "CMD" keyword
Incorrect array format
4fill in blank
hard

Fill both blanks to set the healthcheck retries and timeout values.

Docker
healthcheck:
  retries: [1]
  timeout: [2]
Drag options to blanks, or click blank then click option'
A3
B5
C30s
D10s
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping retries and timeout values
Using string for retries
Wrong time format
5fill in blank
hard

Fill all three blanks to create a healthcheck that runs every 20 seconds, retries 4 times, and has a timeout of 15 seconds.

Docker
healthcheck:
  interval: [1]
  retries: [2]
  timeout: [3]
Drag options to blanks, or click blank then click option'
A20s
B4
C15s
D10s
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up retries and timeout
Using wrong time units
Missing 's' in time values