Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
FREEDOM251

Freedom251 › Blog › Docker

How to Add a Healthcheck to Uptime Kuma in Docker Compose

By Freedom251 Team · · 8 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add a Docker Compose healthcheck that requests Uptime Kuma at http://localhost:3001 from inside its container. The check below waits 30 seconds before judging startup, probes every 30 seconds, allows 10 seconds per probe, and marks the container unhealthy after five consecutive failures. A healthcheck reports status; it does not restart a failed container, so keep a separate restart policy.

Recommended Docker Compose configuration

Uptime Kuma’s documented Compose deployment uses the louislam/uptime-kuma:2 image, stores application data at /app/data, and listens on container port 3001. This complete example adds a healthcheck while preserving those settings:

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
services:
  uptime-kuma:
    image: louislam/uptime-kuma:2
    ports:
      - "3001:3001"
    volumes:
      - uptime-kuma-data:/app/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3001"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 30s

volumes:
  uptime-kuma-data:

Save the service in your Compose file, then apply it with:

docker compose up -d

The restart: unless-stopped line is intentionally separate from healthcheck. It tells Docker what to do when the main process exits, whereas the healthcheck only records whether the running process answers the probe.

#1 Best Overall
Sale
TP-Link OC200 V3, Hardware Controller
  • Hardware Controller with Professional Network Management-Centralized management for up to 100 Omada devices including Omada access points, Omada Security Gateways and Jetstream switches.
  • Premium Hardware Design-Industry-leading flexible Rackmount/Desktop design with a powerful chipset, durable metal casing, 2 fast ethernet ports and 1 USB 2.0 port for auto backup.
  • Dual power selection-Support PoE (802.3af/802.3at) and micro USB for flexible installations.
  • Easy Network Monitor & Maintenance-The easy-to-use dashboard makes it simple to see your real-time network status and improve network maintenance for peace of mind.
  • Cloud Access with No License Fee-Enjoy cloud service with no license fee with the use of OC200. Remote Cloud access and Omada app brings centralized cloud management of the whole network from different sites—all controlled from a single interface anywhere, anytime.

Why the check targets localhost:3001

Compose executes the healthcheck command inside the Uptime Kuma container. Uptime Kuma listens on port 3001 in that container, so the correct in-container target is http://localhost:3001.

The port mapping 3001:3001 publishes the container’s port to clients outside Docker. It is needed when you open Kuma from a browser on the host or another machine, but it is not needed for a probe running inside the same container. Using the host’s published address can introduce unnecessary routing and binding assumptions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The -f option makes curl return a failure status for HTTP errors instead of treating every HTTP response as success. A response such as 404 or 500 therefore causes Docker to count that probe as failed. A successful HTTP response produces a zero exit status and allows the container to remain healthy.

Check that the exact Uptime Kuma image tag you deploy contains curl before relying on this command. Image contents can change between tags. If curl is unavailable, choose a client that is actually present in your selected image and preserve the same behavior: connect to the in-container listener and return a non-zero status when the request fails.

Rank #2
Sale
Keep Connect MAX Router Rebooter, Wi-Fi Reset Device, Monitors Connectivity and Resets When Required. No App Necessary. If You Enter a Phone Number it Will Send Texts Upon resets.
  • Automatic Router Rebooter / Reset - Stop manually restarting your router! Automate the process to ensure highly reliable internet connection uptime
  • Constantly Monitors Router and/or Modem Internet Health. Keep Connect provides 24/7/365 protection to ensure that your smart home and connected devices are always online and available.
  • Notifications - Free Texts or Emails from Keep Connect notifying you of detected eventsif you choose to enter your phone number/email. You may also choose No Notifications.
  • Perfect for Smart Home Reliability - Schedule Periodic Resets to keep your connection fresh and fast.
  • Premium Cloud Services App Available (iOS App Store and Google Play Store) - Our Premium Keep Connect Cloud Services platform allows using our Online/Mobile App to monitor many locations in one place as well. Cloud Services allows remote management of devices at all locations as well as heartbeat monitoring of your Keep Connects to notify you in the event of an ISP internet outage at one of your sites.

What each healthcheck setting does

Setting Value in the example Effect
test ["CMD", "curl", "-f", "http://localhost:3001"] Runs the probe directly, without a shell, inside the container. The first item, CMD, tells Compose that the remaining items are the executable and its arguments.
interval 30 seconds Schedules a new probe approximately every 30 seconds after the previous probe is handled.
timeout 10 seconds Limits how long Docker waits for one probe to finish before counting that probe as failed.
retries 5 Requires five consecutive failed probes before the status changes to unhealthy. A successful probe resets the consecutive-failure count.
start_period 30 seconds Provides startup grace time. Failures during this period do not count toward the normal failure threshold unless a probe succeeds and regular checking begins.

These values are a practical starting policy, not a measured performance benchmark. Two published Compose examples use the same port and localhost request but choose different tolerances: one uses a two-minute startup period with five retries, while another uses a 10-second startup period with three retries and a five-second timeout. Select values based on the startup time you observe on your host and the delay you can accept before declaring a problem.

Compose implementations that support it may also accept start_interval, which controls probe frequency during the startup period. Use it only when your installed Docker Compose version supports that field; the four settings in the example are broadly understood by current Compose implementations.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to add the check safely

  1. Locate the Compose project. Open the YAML file that defines the service named uptime-kuma. Keep the existing data volume and port mapping unless you have deliberately changed them.
  2. Add the healthcheck under the service. Indent healthcheck at the same level as image, ports, volumes, and restart. YAML indentation is significant.
  3. Confirm the probe command. Use the list form shown above. It avoids shell parsing differences and passes curl, -f, and the URL as separate arguments.
  4. Recreate or update the service. Run docker compose up -d. Compose applies the changed healthcheck while keeping the named volume mounted at /app/data.
  5. Read the summary status. Run docker compose ps. The service should eventually display a healthy state after its startup grace period and a successful probe.
  6. Inspect detailed health data when needed. First identify the container name or ID from docker compose ps, then run docker inspect <container> --format '{{json .State.Health}}'. The result includes the current status, failing streak, and recent probe output.

The inspection command is especially useful when a service remains in starting or changes to unhealthy; Docker records the probe’s exit code and output there rather than in the Uptime Kuma web interface.

Choosing stricter or more tolerant timings

Use a longer start_period for slow first starts

If the host is restoring a large Uptime Kuma data directory or the first boot consistently takes more than 30 seconds, increase start_period. A two-minute period is used by one published deployment example. This delays unhealthy reporting during known initialization work; it does not make a genuinely broken process healthy.

Rank #3
LANProbe 10/100/1000 Gigabit Ethernet/USB Bypass Network Tap
  • (10/100/1G) Gigabit Bypass network tap / sniffer equivalent to port mirror on a switch.
  • The two monitor/sniff ports are isolated from the network being monitored.
  • Automatic bypass of device on power fail.
  • Power-over-Ethernet (POE) pass-through. Rated at .75A max at 57vdc
  • 5v power through USB3 port or 5v wall transformer (or both). ~500ma consumption.

Use interval for the detection delay you need

A 30-second interval means a short outage may not be observed immediately. A shorter interval detects failures sooner but creates more probe traffic and more frequent process activity. Because the request stays inside the container, the traffic is local, but the command still consumes a process launch and a small amount of CPU.

Set timeout above normal response latency

The timeout should exceed the normal time for Kuma to accept a local HTTP request. A five- or 10-second timeout is generous for a local listener; choose the value that matches your environment rather than treating either number as mandatory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use retries to filter transient failures

With five retries and a 30-second interval, Docker can take several minutes to reach unhealthy after repeated failures. Fewer retries produce faster status changes but are more sensitive to brief CPU, disk, or process stalls. More retries reduce false alarms while delaying dependent-service decisions.

Health status versus automatic restarts

A healthcheck does not restart Uptime Kuma. It only updates Docker’s health state to starting, healthy, or unhealthy. The restart: unless-stopped policy handles container exits, such as when the main process terminates. It does not, by itself, restart a container merely because a healthcheck reports unhealthy.

Rank #4
ConnectSense Rebooter Pro – Smart Automatic Router & Modem Rebooter | Internet Monitor, Power Cycle Scheduler, Remote Reboot via App, Local HTTPS API - MPN: CS-REBOOTER-PRO
  • NEVER MANUALLY REBOOT YOUR ROUTER AGAIN – The ConnectSense Rebooter Pro plugs between your modem or router and the wall outlet, automatically detecting lost internet connectivity across up to 5 network targets and power cycling your equipment instantly — keeping your home, office, or remote location always online 24/7.
  • SCHEDULED & AUTOMATIC REBOOTS – Set up to 10 custom reboot schedules to proactively clear memory leaks, prevent slowdowns, and keep your connection fresh — even before problems occur. Perfect for smart homes, security cameras, smart locks, thermostats, and any device that depends on a stable internet connection.
  • REMOTE CONTROL FROM ANYWHERE – Trigger a manual reboot anytime from the free ConnectSense app (iOS & Android) or directly from your home network. Whether you're traveling, at work, or managing a vacation rental or remote office, you stay in control of your network without needing to be on-site.
  • AUTOMATIC POWER OUTAGE RECOVERY – When the power goes out, the Rebooter Pro automatically restores and reboots your networking equipment once power returns, eliminating downtime and the need for manual intervention. Ideal for unattended locations, rental properties, and small business networks.
  • INTEGRATOR & PRO-GRADE FEATURES – The only router rebooter with a built-in local HTTPS API, giving IT professionals, smart home integrators, and power users advanced automation, monitoring, and remote management capabilities — no cloud subscription required for local control.

If automatic recovery from an unhealthy-but-still-running process is required, you need an additional supervisor or an operational process that observes health state and recreates the service. Do not assume that adding healthcheck changes Docker’s restart behavior.

Making another Compose service wait for Kuma

Compose can use the health result when creating a dependent service. Define the dependency with condition: service_healthy:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
services:
  uptime-kuma:
    image: louislam/uptime-kuma:2
    # ports, volumes, restart and healthcheck as above

  kuma-client:
    image: your-client-image
    depends_on:
      uptime-kuma:
        condition: service_healthy

With this condition, Compose waits for Uptime Kuma’s healthcheck to pass before creating kuma-client. The dependency affects creation order; it is not a guarantee that Kuma will remain healthy forever after the dependent service starts. The dependent service should still handle later connection failures.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Comparing common probe choices

Choice Advantages Risks or trade-offs
curl -f http://localhost:3001 Checks the actual local HTTP listener and treats HTTP errors as failures. Requires curl in the image. Confirm availability for the exact image tag.
curl -L localhost:3001 Follows redirects and is used by one published Uptime Kuma Compose example. Without -f, some HTTP error responses may still produce a successful exit status. Add failure handling if status-code errors must mark the container unhealthy.
Host-published address Tests an externally reachable route from outside the container. It is the wrong abstraction for an in-container service check and can fail because of host binding or routing details even when Kuma’s own listener works.
Shell form such as CMD-SHELL Allows shell operators, environment expansion, or compound checks. Introduces shell quoting and interpretation. Use it only when those features are needed; the direct CMD list is simpler here.

The right probe answers the question you care about. The localhost request asks whether the Uptime Kuma process is accepting HTTP connections inside its container. An external probe, such as a separate monitoring system, answers whether users can reach the published endpoint through the host and network. They are complementary checks, not interchangeable ones.

Best Value
Sale
[Upgraded] AURSINC NanoVNA-H Vector Network Analyzer 9KHz -1.5GHz Latest HW V3.7 HF VHF UHF Antenna Analyzer, Measuring S Parameters, SWR, Phase, Delay, Smith Chart
  • [UPGRADED NanoVNA-H] New HW Version V3.7. It is upgradeable as new firmware is developed. With MicroSD card port now can have the measurement data or the screenshots saved in the it at anytime. Added battery circuit management, more secure. Redesigned PCB, you can connect to mobile phone with Type C-Type C cable (original PCB needs OTG cable), see a clear HD image on your phone. Added a ABS case, which is protective and dust-proof. Disply: 2.8 inch TFT (320 x240).
  • [IMPROVED FREQUENCY ALGORITHM] The improved frequency algorithm can use the odd harmonic extension of si5351 to support the measurement frequency up to 1.5GHz. The 9KHz-300MHz frequency range of the si5351 direct output provides better than 70dB dynamic, The extended 300M-900MHz band provides better than 60dB of dynamics, and the 900M-1.5GHz band is better than 40dB of dynamics.
  • [MULTIPLE FUNCTIONS] The default firmware main function is used for antenna performance measurement. The TX/RX method can measure the complete S11 and S21 parameters. If you need to obtain S12 and S22, you need to manually replace the transceiver port wiring. The CH0 output level is increased to 0dBm when using the fundamental wave, resulting in more accurate reflection measurement.
  • [SUPPORT ANDROID PHONE & PC SOFTSARE CONTROL] Designed a practical and simple control application on PC, you can download touchstone(SNP) files for radio design and simulation software. There is a PC interface that adds functionality and lets you work interactively on a bigger screen. Supports time domain analysis function (TDR). Compatible with most Android mobile phones, convenient for connecting to mobile phones. Support Windows Computer Control.
  • [STRONG AND SECURE POWER SUPPLY] This VNA is battery powered or USB powered. Built in 650mAh battery, could work for 2 hours continuously. For longer measurement time, kindly connect an external power source. The product interface displays battery usage, providing a clear understanding of the power status.

Troubleshooting an unhealthy container

The status remains starting

  • Wait through the configured start_period and at least one complete probe interval.
  • Check docker inspect <container> --format '{{json .State.Health}}' for recent output.
  • If startup regularly exceeds the grace period, increase start_period rather than reducing the probe’s correctness.

The probe says “curl: not found”

The image does not contain the executable named in test. Verify with docker exec <container> command -v curl. Either use a client present in the image or select an image version whose documented contents include the tool. Do not silently replace the check with a command you have not verified.

The probe reports “connection refused”

  • Confirm Uptime Kuma is listening on port 3001 inside the container, not only that the host publishes port 3001.
  • Inspect container logs with docker compose logs uptime-kuma to find application startup or crash messages.
  • Check that the healthcheck URL is exactly http://localhost:3001 and that YAML indentation did not attach the healthcheck to another service.

The probe succeeds but users cannot open Kuma

An in-container healthcheck cannot test host firewall rules, reverse-proxy configuration, DNS, TLS termination, or external routing. Verify the ports mapping, host firewall, proxy route, and client network separately. A healthy local listener and an unreachable published endpoint can exist at the same time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The container is unhealthy but never restarts

This is expected with Docker’s standard healthcheck behavior. Review the separate restart policy and the container’s main-process state. If the process is still running, Docker generally records the unhealthy state without treating it as an exit.

Keep Uptime Kuma storage reliable

The Uptime Kuma project warns that NFS and other network file systems are not supported for its data directory. Use a local directory or a Docker volume for /app/data. A successful HTTP probe cannot detect every database or filesystem problem, and it cannot repair corrupted or unavailable persistent data. Treat storage reliability as a separate operational concern from application health.

Practical validation checklist

  • The service uses louislam/uptime-kuma:2 or the image tag you intentionally selected.
  • The data path /app/data is backed by a local directory or Docker volume rather than NFS.
  • The healthcheck runs curl -f http://localhost:3001 inside the container.
  • The selected image contains curl, or the command has been replaced with a verified equivalent.
  • start_period reflects the host’s observed startup time.
  • interval, timeout, and retries match your desired failure-detection delay.
  • restart is configured separately if process-exit recovery is required.
  • docker compose ps and docker inspect show the expected health state after deployment.

For the documented Uptime Kuma Compose layout, the essential decision is simple: probe the container’s own port 3001 through localhost, give startup enough grace, and keep health reporting separate from restart automation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DockerDocker ComposeHealthcheckself-hostingUptime Kuma

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.