analyze-docker-runtime-errors

Analyze Docker runtime errors for PHP containers. Locate and identify common error sources such as 502 gateway errors, out-of-memory (OOM) terminations, connection refused, and permission-related errors.

Last repository push
GitHub Stars
109
Forks
26
Issues / PRs
1

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 "analyze-docker-runtime-errors" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-a0cfe393ac08d1e1bb084cbd3a6841f2db8ec5de0a0e69a7e1cff5382b49be55. 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

Analyze Docker runtime errors for PHP containers. Locate and identify common error sources such as 502 gateway errors, out-of-memory (OOM) terminations, connection refused, and permission-related errors.

0 Downloads

Introduction source: third_party · dykyi-roman · 0.0.1 Reference

SkillPi interpretation

Tasks
Analyzes Docker runtime errors for PHP containers. Identifies 502 Bad Gateway, OOM kills, connection refused, and permission issues.
Inputs and outputs
```markdown
Limits and differences
services: php-fpm: deploy: resources: limits: memory: 512M reservations: memory: 256M ```
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: analyze-docker-runtime-errors
description: Analyzes Docker runtime errors for PHP containers. Identifies 502 Bad Gateway, OOM kills, connection refused, and permission issues.

Docker Runtime Error Analysis

Analyze running PHP containers for runtime failures and provide targeted diagnosis and fixes.

Runtime Error Categories

Error Symptom Root Cause
502 Bad Gateway Nginx returns 502 PHP-FPM not running or crashed
OOM Killed Container restarts memory_limit or container limit exceeded
Connection refused Service unreachable Container not ready or wrong network
Permission denied File operation fails UID/GID mismatch or read-only fs
Segmentation fault Process crashes Extension bug or memory corruption
Slow requests Timeouts, 504 errors PHP-FPM pool exhaustion

Detection Patterns

1. 502 Bad Gateway (PHP-FPM Not Running)

# FIX: Add healthcheck and proper depends_on
services:
  php-fpm:
    healthcheck:
      test: ["CMD-SHELL", "php-fpm-healthcheck || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 3
  nginx:
    depends_on:
      php-fpm:
        condition: service_healthy

2. OOM Killed

; php.ini -- match memory_limit to container limit
; Container limit 256MB -> PHP memory_limit should be lower
memory_limit = 128M
# docker-compose.yml memory constraints
services:
  php-fpm:
    deploy:
      resources:
        limits:
          memory: 512M
        reservations:
          memory: 256M

3. Connection Refused

# FIX: Proper service dependencies and networking
services:
  php-fpm:
    depends_on:
      redis: { condition: service_healthy }
      database: { condition: service_healthy }
    networks: [app-network]
  redis:
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
    networks: [app-network]
  database:
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"]
    networks: [app-network]
networks:
  app-network:
    driver: bridge

4. Permission Denied (File Ownership)

# FIX: Set correct ownership in Dockerfile
RUN mkdir -p /var/www/var/cache /var/www/var/log \
    && chown -R www-data:www-data /var/www/var
COPY --chown=www-data:www-data . /var/www
USER www-data

5. PHP-FPM Pool Exhaustion

; Sizing formula: max_children = (available_memory - overhead) / avg_process_memory
; Example: (512MB - 64MB) / 32MB = ~14
[www]
pm = dynamic
pm.max_children = 14
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.max_requests = 500

6. Segmentation Fault

; Mitigation: disable problematic extensions one by one
; Common cause: OPcache + Xdebug conflict
opcache.enable=0  ; Test if OPcache causes segfault
opcache.fast_shutdown=0

Grep Patterns

# Find PHP-FPM configuration
Grep: "pm\.(max_children|start_servers|max_requests)" --glob "**/www.conf" --glob "**/php-fpm*.conf"

# Find memory_limit settings
Grep: "memory_limit" --glob "**/php.ini" --glob "**/*.ini"

# Find healthcheck definitions
Grep: "healthcheck" --glob "**/docker-compose*.yml"

# Find depends_on without condition
Grep: "depends_on:" --glob "**/docker-compose*.yml"

# Find error logging configuration
Grep: "error_log|log_errors" --glob "**/php.ini" --glob "**/*.ini"

PHP-FPM Specific Diagnostics

Log Pattern Diagnosis Fix
server reached pm.max_children Pool exhaustion Increase max_children or optimize code
child exited on signal 11 Segmentation fault Check extensions, disable OPcache
child exited with code 255 Fatal PHP error Check error log for details
execution timed out Slow script Profile code, check DB queries
unable to open primary script Wrong document root Fix Nginx fastcgi_param SCRIPT_FILENAME

Severity Classification

Pattern Severity Impact
OOM Killed (recurring) Critical Service unavailable, data loss risk
PHP-FPM pool exhaustion Critical All requests blocked
Segmentation fault Critical Process crash, intermittent failures
502 Bad Gateway Major Service unavailable
Connection refused Major Dependent service failures
Permission denied (runtime) Major Feature degradation
Slow requests (< threshold) Minor User experience impact

Output Format

### Runtime Error: [Category]

**Severity:** Critical/Major/Minor
**Container:** `<service_name>`
**Log Pattern:** `<error message from logs>`

**Diagnosis:**
[Root cause analysis with evidence from logs]

**Steps to Verify:**
1. [Command to confirm the issue]
2. [Command to check related state]

**Fix:**
```yaml
# docker-compose.yml or config change

Monitoring: [How to detect this issue early in production]

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 针对 PHP 容器 Docker 运行时错误的诊断与修复,属于开发运维高频刚需场景
  • 提供具体错误分类、检测模式、修复方案和监控建议,具有明确实用价值
Trigger Precision90/100

Highlights

  • description 明确描述功能范围,覆盖多种错误类型和排查手段,边界清晰
Structure and Standards95/100

Highlights

  • 文档结构清晰,包含错误分类表、检测模式、修复代码示例、grep 模式、诊断表、严重性分级和输出格式
  • frontmatter 完整,单文件未超限
Execution Reliability90/100

Highlights

  • 提供的修复方案(docker-compose.yml 配置、php.ini 参数、Dockerfile 权限设置等)来源明确,参数合理
  • 覆盖主要异常场景,且无不可逆操作
Evidence Verifiability (mean of the first four)90/100

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.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

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.