Skip to content

Instantly share code, notes, and snippets.

@shotgunner
Last active November 17, 2023 23:40
Show Gist options
  • Save shotgunner/ca40e9da1e436002fe52faf43a494de5 to your computer and use it in GitHub Desktop.
Save shotgunner/ca40e9da1e436002fe52faf43a494de5 to your computer and use it in GitHub Desktop.
How to view docker healthcheck logs?

How to see healthcheck Logs ?

Use docker inspect is different in swarm mode and normal mode if you wnat to use it in swarm mode:

  • Manager nodes: use this command for services. (but if you want to see healthceck logs of specific container see worker nodes section):

    • docker inspect --format "{{json .Spec.TaskTemplate.ContainerSpec.Healthcheck }}" hinava_dashboard |jq
  • Worker nodes: you should use complete name of the container that completed with <tab> key

    • docker inspect hinava_filebeat.1.umvobmm9wrjdz1b08y5jibvl2 | grep -B 10 -A 10 "health"
    • docker inspect --format "{{json .State.Health }}" hinava_dashboard.1.kzudauikpx47dulfxlci4mh7e

If you are not using swarm ,in normal mode the code is the same as the worker node:

  • docker inspect hinava_filebeat.1.umvobmm9wrjdz1b08y5jibvl2 | grep -B 10 -A 10 "health"
  • docker inspect --format "{{json .State.Health }}" hinava_dashboard.1.kzudauikpx47dulfxlci4mh7e

For more information see here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment