Skip to content

Instantly share code, notes, and snippets.

@jonuwz
Last active July 17, 2024 10:01
Show Gist options
  • Save jonuwz/2fcb148fb192fb8ac50305977add09dc to your computer and use it in GitHub Desktop.
Save jonuwz/2fcb148fb192fb8ac50305977add09dc to your computer and use it in GitHub Desktop.
splunk container healthcheck
FROM splunk/splunk:9.0.4.1
HEALTHCHECK --interval=60s --timeout=60s --start-period=60s \
CMD curl -s -k -f --retry 3 --retry-connrefused --max-time 3 --retry-delay 5 --retry-max-time 60 "https://localhost:8089/" -o /dev/null -w "%{http_code}" && whoami || bash -c 'whoami;kill -s 15 1 && (sleep 10; kill -s 9 1)'
docker inspect --format "{{json .State.Health}}" lala | jq .
{
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2024-07-17T10:56:25.122334874+01:00",
"End": "2024-07-17T10:56:25.259282165+01:00",
"ExitCode": 0,
"Output": "200ansible\n"
},
{
"Start": "2024-07-17T10:57:25.260814748+01:00",
"End": "2024-07-17T10:57:25.360594761+01:00",
"ExitCode": 0,
"Output": "200ansible\n"
},
{
"Start": "2024-07-17T10:58:25.361583376+01:00",
"End": "2024-07-17T10:58:25.443363616+01:00",
"ExitCode": 0,
"Output": "200ansible\n"
},
{
"Start": "2024-07-17T10:59:25.444510466+01:00",
"End": "2024-07-17T10:59:25.572295065+01:00",
"ExitCode": 0,
"Output": "200ansible\n"
},
{
"Start": "2024-07-17T11:00:25.573592958+01:00",
"End": "2024-07-17T11:00:25.710717408+01:00",
"ExitCode": 0,
"Output": "200ansible\n"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment