Add a HEALTHCHECK to an Image

easy 10 XP ~4 minHands-on lab

Labs have no container engine, so nothing is built or started: your files are checked by reading them, the way a reviewer or a CI linter would. docker-compose config (to validate Compose files) and hadolint (a Dockerfile linter) are installed.

The service in /home/student/projects/image-resizer sometimes hangs while its process keeps running, so nothing restarts it. It answers GET /healthz on port 8777 with status 200 when it is healthy.

Task

Add a HEALTHCHECK to the Dockerfile that:

  • calls http://localhost:8777/healthz with curl, failing on any HTTP error status (curl -f)
  • runs every 30 seconds, with a 3-second timeout, marking the container unhealthy after 3 failures in a row
  • gives the service 10 seconds to start before failures count

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

TerminalNot started

Your machine is ready to start

Create a free account to open a machine and get graded.