HEALTHCHECK & application readiness

Describe a useful health signal

Lesson 9 of 20 · 12 min · Module 3: Persistence and a first project

A process can exist while its application is unable to serve requests.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Ask a meaningful question
  • Choose a bounded probe

The idea

Image instructions are an ordered build contract. A later instruction can change a default established earlier; the final stage determines the output image.

01Ask a meaningful question

A health command should reflect whether the application can perform useful work. Merely seeing a process ID answers a narrower question.

02Choose a bounded probe

Real probes need timeouts and a sensible interval. Overly expensive probes can increase load during an outage instead of helping diagnose it.

03Distinguish declaration from execution

The lab checks the configured health command. It does not run healthcheck.js. A real image must contain that file and the probe must be tested on a real runtime.

Your turn

Use node:22-alpine and /app. Add EXPOSE 3000 and HEALTHCHECK --interval=30s CMD node healthcheck.js. Start node server.js in exec form.

What the checks look for

  • Documents application port 3000
  • Configures the health command and interval
  • Keeps application startup
Try it in the editor →

Take this with you

A health signal should describe useful behavior and have a bounded cost.

Go a little further

Compare a startup probe with a readiness check conceptually.

Learn Docker & Containers for free

20 short lessons with real code and instant checks.

See the whole course →