Bird
0
0

A health check command in Dockerfile is failing with "curl: command not found" error. How can you fix this?

medium📝 Debug Q7 of 15
Spring Boot - Docker and Deployment
A health check command in Dockerfile is failing with "curl: command not found" error. How can you fix this?
AChange the command to use wget instead without installing curl.
BRun the health check command outside the container.
CRemove the HEALTHCHECK instruction entirely.
DInstall curl in the Docker image before running the health check.
Step-by-Step Solution
Solution:
  1. Step 1: Identify cause of error

    "curl: command not found" means curl is missing in the container image.
  2. Step 2: Fix by installing curl

    Add installation of curl in Dockerfile before HEALTHCHECK runs.
  3. Final Answer:

    Install curl in the Docker image before running the health check. -> Option D
  4. Quick Check:

    Missing curl = install curl in image [OK]
Quick Trick: Ensure curl is installed in image for HEALTHCHECK commands [OK]
Common Mistakes:
  • Removing HEALTHCHECK instead of fixing command
  • Using wget without verifying availability
  • Running health check outside container

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes