Last active
December 17, 2024 23:40
-
-
Save supermarsx/d4c8ae4b11134247ac3f0acf75258290 to your computer and use it in GitHub Desktop.
Docker compose healthchecks for containers
This file contains 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
# mariadb | |
healthcheck: | |
test: healthcheck.sh --connect --innodb_initialized | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 10s | |
#ENV: MARIADB_ROOT_PASSWORD: password... | |
# mariadb alternative | |
healthcheck: | |
test: ["CMD-SHELL", "mysql -u root -pexample -e 'SELECT 1' || exit 1"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 10s | |
# nextcloud fpm | |
healthcheck: | |
test: php -r 'if (@fsockopen("127.0.0.1", 9000)) print("OK"); else print("ERROR");'; | |
interval: 20s | |
timeout: 10s | |
retries: 3 | |
start_period: 10s | |
# generic nginx | |
healthcheck: | |
test: curl -sf http://127.0.0.1/ | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 15s | |
# sqlpad | |
healthcheck: | |
test: ["CMD-SHELL", "wget --quiet --tries=1 --spider http://127.0.0.1/ || exit 1"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 15s | |
# generic nginx manager | |
healthcheck: | |
test: curl -sf http://127.0.0.1:81/ | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 15s | |
# portainer | |
healthcheck: | |
test: wget --no-verbose --tries=1 --spider http://localhost:9000/ || exit 1 | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 10s | |
# gitea | |
healthcheck: | |
test: ["CMD", "curl", "-sf", "http://127.0.0.1:80/"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
# registry | |
healthcheck: | |
test: ["CMD-SHELL", "wget --quiet --spider http://127.0.0.1:5000/ || exit 1"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 10s | |
# registry ui | |
healthcheck: | |
test: ["CMD-SHELL", "wget --quiet --spider http://127.0.0.1:80/ || exit 1"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 10s | |
# redis | |
healthcheck: | |
test: ["CMD-SHELL", "redis-cli ping | grep PONG || exit 1"] | |
interval: 10s | |
timeout: 5s | |
retries: 3 | |
start_period: 10s | |
# drone runner | |
healthcheck: | |
test: ["CMD-SHELL", "wget --quiet --spider http://127.0.0.1:3000/healthz || exit 1"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 30s | |
# drone | |
healthcheck: | |
test: ["CMD-SHELL", "wget --quiet --spider http://127.0.0.1/healthz || exit 1"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
start_period: 30s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment