Skip to content

Instantly share code, notes, and snippets.

@arsalanses
Created February 1, 2023 20:08
Show Gist options
  • Select an option

  • Save arsalanses/68acaaf81879bda566302c38be91fab3 to your computer and use it in GitHub Desktop.

Select an option

Save arsalanses/68acaaf81879bda566302c38be91fab3 to your computer and use it in GitHub Desktop.
Check the container's health status
#!/bin/bash
# Check if the Docker container is running
if [ "$(docker inspect -f '{{.State.Running}}' container_name)" = "true" ]; then
echo "Docker container is running."
else
echo "Docker container is not running."
exit 1
fi
# Check the container's health status
if [ "$(docker inspect -f '{{.State.Health.Status}}' container_name)" = "healthy" ]; then
echo "Docker container is healthy."
else
echo "Docker container is not healthy."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment