A Gamers Grind / XFGN / LM
Status
  • 🖥️www.agamersgrind.com
  • 🏙️--- Public Files ---
    • 👋Welcome, friends
    • ⛑️I need help!
    • ☕Buy me a Coffee
  • 📚Guides
    • Mini Guides
      • Valheim FPS Boost
      • Redirect domain to Google Site
      • Docker Compose
        • 'All' Compose File
        • Add Health Check to Container
        • Mount NFS Share to Container
        • Map hostname to container
    • Portainer and GitOps
      • Set up GitHub
      • Install Portainer
      • Create your first GipOps Compose file
      • Deploy your first GitOps stack
      • Managing your production compose files
    • Cloudflare
      • Domains
      • Generate an API Key
      • Tunnel
        • Create a Tunnel
        • Create a Proxy (Public Hostname)
        • Access Groups & Authentication
      • Dynamic DNS
    • Pterodactyl
      • Creating a new Panel
      • Creating a new Wings node
      • Join servers via domain
      • Configuring your Node Database
      • Server Best Practices & Suggestions
      • Troubleshooting
  • 🎮Game Servers
    • Valheim Public
    • Valheim Private
    • MultiMC (Minecraft)
    • CreateCraft (Minecraft)
    • Insurgency Sandstorm
  • ⚔️AGG Moderation
    • ❔Creating a new Server
    • Approving Valheim Application
  • 🗄️Internal Documentation
Powered by GitBook
On this page
  • Health Checks
  • Web Page check

Was this helpful?

  1. Guides
  2. Mini Guides
  3. Docker Compose

Add Health Check to Container

Previous'All' Compose FileNextMount NFS Share to Container

Last updated 1 year ago

Was this helpful?

The easiest way to add health checks to your docker containers is to update the Compose file, below you will find some examples. The Health Check needs to be added at the same indentation (how many 'TAB' keys) as your 'image', 'volume' and/or 'environment' lines, per below

version: "2.1"
services:
  app:
    image: ghcr.io/linuxserver/plex:1.32.6
    network_mode: host
    ports:
      - 32400:32400
    volumes:
      - app:/config
      - media:/media
    restart: unless-stopped
    healthcheck:
      test: curl --connect-timeout 15 --silent --show-error --fail http://localhost:32400/identity
      interval: 1m
      timeout: 30s
      retries: 3
      start_period: 1m

Health Checks

Please read the code you are adding and ensure your variables match, otherwise you will have issues!

Web Page check

#This will check if $HEALTHCHECK (eg http://myplexserver:32400 ) is accessible and if not, restart the container.
healthcheck:
  test: curl --connect-timeout 15 --silent --show-error --fail $HEALTHCHECK
  interval: 1m
  timeout: 30s
  retries: 3
  start_period: 1m

One thing to note is that not all containers will need health checks. Health checks do require additional compute to do and it may be better using a cloud service (such as ) or an internally hosted service like UptimeKuma

📚

Time Required

5 Minutes

Difficulty

Low

UptimeRobot