create-docker-healthcheck
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "create-docker-healthcheck" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4672e828b5f1a028073c1b62f7447a3947dbdb91ba3223372ced9bf2b74555ce. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Generate Docker healthcheck scripts for PHP services. Used to create healthcheck scripts and configuration examples for PHP-FPM, Nginx, and custom endpoints.
Introduction source: third_party · dykyi-roman · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Generates Docker health check scripts for PHP services. Creates PHP-FPM, Nginx, and custom endpoint health checks.
- Testing
- Not tested
Browse files
Frontmatter
name: create-docker-healthcheck
description: Generates Docker health check scripts for PHP services. Creates PHP-FPM, Nginx, and custom endpoint health checks.Docker Health Check Generator
Generates health check scripts and configurations for PHP Docker containers.
Generated Files
docker/healthcheck/
php-fpm-healthcheck.sh # PHP-FPM process health check
http-healthcheck.sh # HTTP endpoint health check
combined-healthcheck.sh # Combined multi-service check
PHP-FPM Health Check (cgi-fcgi based)
#!/bin/bash
# php-fpm-healthcheck.sh
# Checks PHP-FPM status via /ping endpoint using cgi-fcgi
set -eo pipefail
FCGI_CONNECT="${FCGI_CONNECT:-localhost:9000}"
FCGI_STATUS_PATH="${FCGI_STATUS_PATH:-/ping}"
EXPECTED_RESPONSE="${EXPECTED_RESPONSE:-pong}"
if ! command -v cgi-fcgi &> /dev/null; then
echo "ERROR: cgi-fcgi not found. Install libfcgi-bin."
exit 1
fi
RESPONSE=$(SCRIPT_NAME="${FCGI_STATUS_PATH}" \
SCRIPT_FILENAME="${FCGI_STATUS_PATH}" \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect "${FCGI_CONNECT}" 2>/dev/null)
if echo "${RESPONSE}" | grep -q "${EXPECTED_RESPONSE}"; then
echo "OK: PHP-FPM is healthy"
exit 0
else
echo "FAIL: PHP-FPM returned unexpected response"
exit 1
fi
PHP-FPM Pool Configuration (required)
; /usr/local/etc/php-fpm.d/www.conf
; Enable ping/status endpoints
pm.status_path = /status
ping.path = /ping
ping.response = pong
HTTP Endpoint Health Check (curl-based)
#!/bin/bash
# http-healthcheck.sh
# Checks application health via HTTP /health endpoint
set -eo pipefail
HEALTH_URL="${HEALTH_URL:-http://localhost:80/health}"
TIMEOUT="${HEALTH_TIMEOUT:-5}"
EXPECTED_STATUS="${EXPECTED_STATUS:-200}"
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
--max-time "${TIMEOUT}" \
--fail \
"${HEALTH_URL}" 2>/dev/null) || true
if [ "${RESPONSE_CODE}" = "${EXPECTED_STATUS}" ]; then
echo "OK: HTTP health check passed (${RESPONSE_CODE})"
exit 0
else
echo "FAIL: HTTP health check returned ${RESPONSE_CODE}, expected ${EXPECTED_STATUS}"
exit 1
fi
Combined Health Check Script
#!/bin/bash
# combined-healthcheck.sh
# Checks PHP-FPM process + custom application logic
set -eo pipefail
FCGI_CONNECT="${FCGI_CONNECT:-localhost:9000}"
HEALTH_URL="${HEALTH_URL:-http://localhost:80/health}"
# Check 1: PHP-FPM process is running
if ! pgrep -x "php-fpm" > /dev/null 2>&1; then
echo "FAIL: PHP-FPM process not running"
exit 1
fi
# Check 2: PHP-FPM responds to ping
PING_RESPONSE=$(SCRIPT_NAME=/ping \
SCRIPT_FILENAME=/ping \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect "${FCGI_CONNECT}" 2>/dev/null || true)
if ! echo "${PING_RESPONSE}" | grep -q "pong"; then
echo "FAIL: PHP-FPM not responding to ping"
exit 1
fi
# Check 3: Application health endpoint
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
--max-time 5 "${HEALTH_URL}" 2>/dev/null || true)
if [ "${HTTP_CODE}" != "200" ]; then
echo "FAIL: Application health endpoint returned ${HTTP_CODE}"
exit 1
fi
echo "OK: All health checks passed"
exit 0
Dockerfile HEALTHCHECK Instruction
# Simple PHP-FPM health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD ["php-fpm-healthcheck"] || exit 1
# HTTP endpoint health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -f http://localhost:80/health || exit 1
# Combined health check (copy script into image)
COPY docker/healthcheck/combined-healthcheck.sh /usr/local/bin/healthcheck
RUN chmod +x /usr/local/bin/healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD ["/usr/local/bin/healthcheck"]
Docker Compose Health Check Format
# docker-compose.yml
services:
php-fpm:
build: .
healthcheck:
test: ["CMD", "/usr/local/bin/healthcheck"]
interval: 30s
timeout: 5s
start_period: 20s
retries: 3
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
MYSQL_DATABASE: "${DB_NAME}"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DB_PASSWORD}"]
interval: 10s
timeout: 5s
start_period: 30s
retries: 5
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: "${DB_NAME}"
POSTGRES_USER: "${DB_USER}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 10s
timeout: 5s
start_period: 30s
retries: 5
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
start_period: 5s
retries: 3
rabbitmq:
image: rabbitmq:3-management-alpine
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "check_running"]
interval: 15s
timeout: 10s
start_period: 30s
retries: 5
Dependency Wait Pattern
# docker-compose.yml — services wait for healthy dependencies
services:
php-fpm:
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
Generation Instructions
-
Analyze project stack:
- Identify PHP-FPM version
- Check for Nginx reverse proxy
- List dependent services (MySQL, PostgreSQL, Redis, RabbitMQ)
-
Generate health check scripts:
- PHP-FPM ping check for all setups
- HTTP endpoint check if application exposes /health
- Combined check for production deployments
-
Configure Dockerfile:
- Add HEALTHCHECK instruction
- Copy health check scripts
- Set proper permissions (chmod +x)
-
Configure docker-compose:
- Add healthcheck blocks for each service
- Use
depends_onwithcondition: service_healthy - Tune intervals for each service type
Usage
Provide:
- Services in the stack (PHP-FPM, MySQL, Redis, etc.)
- Health endpoint URL (if application provides one)
- Desired check intervals and thresholds
- Deployment target (development/production)
The generator will:
- Create appropriate health check scripts
- Add Dockerfile HEALTHCHECK instructions
- Configure docker-compose healthcheck blocks
- Set up dependency ordering with health conditions
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 Docker 健康检查解决方案,涵盖 PHP-FPM、HTTP 端点和多服务组合检查
- 包含详细的配置示例和 docker-compose 模板,实用性强
Highlights
- 触发描述清晰明确,覆盖 PHP 服务、Docker 健康检查等核心关键词
- 功能边界清晰,易于用户理解适用场景
Areas to improve
-
文档长度 Reported severity: Minor
文档内容较长(约 450 行),可能影响阅读体验
Recommendation: 建议适当精简内容或采用分章节折叠的方式优化展示
Highlights
- 结构完整,包含生成文件说明、具体脚本、配置示例和使用步骤
- 提供端到端示例,便于用户直接应用
Highlights
- 脚本包含完善的错误处理机制(set -eo pipefail、command 检查、容错处理)
- 参数可配置化,适应不同部署环境
- 使用标准工具(cgi-fcgi、curl、pgrep),兼容性好
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- localhost
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.