Created
February 1, 2023 20:08
-
-
Save arsalanses/68acaaf81879bda566302c38be91fab3 to your computer and use it in GitHub Desktop.
Check the container's health status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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