docker-orchestration-knowledge

Docker orchestration knowledge base. Provide fundamentals for Swarm and Kubernetes, service scaling patterns, and practical patterns and recommendations for PHP load balancing, as a reference for orchestration decisions.

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 "docker-orchestration-knowledge" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-cb00be8acd0f87114d6a2e94c7f1c8da6d343e4d7e797c41a6bb7f4421a2525c. 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

Docker orchestration knowledge base. Provide fundamentals for Swarm and Kubernetes, service scaling patterns, and practical patterns and recommendations for PHP load balancing, as a reference for orchestration decisions.

0 Downloads

Introduction source: third_party · dykyi-roman · 0.0.1 Reference

SkillPi interpretation

Tasks
Docker orchestration knowledge base. Provides patterns for Swarm, Kubernetes basics, service scaling, and load balancing for PHP.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: docker-orchestration-knowledge
description: Docker orchestration knowledge base. Provides patterns for Swarm, Kubernetes basics, service scaling, and load balancing for PHP.

Docker Orchestration Knowledge Base

Quick reference for container orchestration patterns with PHP applications.

Docker Swarm

Core Concepts

+---------------------------------------------------------------------------+
|                       DOCKER SWARM ARCHITECTURE                            |
+---------------------------------------------------------------------------+
|                                                                            |
|   Manager Nodes (Raft consensus)                                           |
|   +--------------------------------------------------------------------+  |
|   | Schedule tasks | Maintain state | Serve API | Manage secrets       |  |
|   +--------------------------------------------------------------------+  |
|            |                    |                    |                      |
|            v                    v                    v                      |
|   Worker Nodes                                                             |
|   +----------------+  +----------------+  +----------------+              |
|   | Task: php (1)  |  | Task: php (2)  |  | Task: php (3)  |              |
|   | Task: nginx(1) |  | Task: nginx(2) |  | Task: worker(1)|              |
|   +----------------+  +----------------+  +----------------+              |
|                                                                            |
|   Overlay Network (encrypted)                                              |
|   +--------------------------------------------------------------------+  |
|   | Service discovery | Load balancing | DNS resolution                |  |
|   +--------------------------------------------------------------------+  |
|                                                                            |
+---------------------------------------------------------------------------+

Stack Deployment

# docker-stack.yml
version: "3.8"

services:
  nginx:
    image: myregistry/nginx:latest
    ports:
      - "80:80"
      - "443:443"
    deploy:
      replicas: 2
      placement:
        constraints:
          - node.role == worker
      update_config:
        parallelism: 1
        delay: 10s
    networks:
      - frontend
      - backend

  php:
    image: myregistry/php-app:latest
    deploy:
      replicas: 3
      resources:
        limits:
          cpus: '1.0'
          memory: 512M
        reservations:
          cpus: '0.25'
          memory: 256M
      update_config:
        parallelism: 1
        delay: 15s
        order: start-first
        failure_action: rollback
    secrets:
      - db_password
      - app_key
    networks:
      - backend

  postgres:
    image: postgres:16-alpine
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.labels.storage == ssd
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - backend

networks:
  frontend:
    driver: overlay
  backend:
    driver: overlay
    internal: true

volumes:
  db-data:
    driver: local

secrets:
  db_password:
    external: true
  app_key:
    external: true
# Deploy stack
docker stack deploy -c docker-stack.yml myapp

# Scale service
docker service scale myapp_php=5

# Update service image
docker service update --image myregistry/php-app:v2 myapp_php

# Rollback service
docker service rollback myapp_php

Kubernetes Overview

PHP Application Resources

+---------------------------------------------------------------------------+
|                    KUBERNETES RESOURCES FOR PHP                             |
+---------------------------------------------------------------------------+
|                                                                            |
|   Ingress  -->  Service  -->  Deployment  -->  Pod                         |
|   (L7 LB)      (L4 LB)      (Replicas)       (Container)                  |
|                                                                            |
|   ConfigMap     Secret       HPA              PDB                          |
|   (php.ini)     (db creds)   (Auto-scale)     (Disruption budget)          |
|                                                                            |
+---------------------------------------------------------------------------+

Deployment Manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: php-app
  labels:
    app: php-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: php-app
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: php-app
    spec:
      containers:
        - name: php-fpm
          image: myregistry/php-app:latest
          ports:
            - containerPort: 9000
          resources:
            requests:
              cpu: "250m"
              memory: "256Mi"
            limits:
              cpu: "1000m"
              memory: "512Mi"
          livenessProbe:
            exec:
              command: ["php-fpm-healthcheck"]
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            exec:
              command: ["php-fpm-healthcheck"]
            initialDelaySeconds: 5
            periodSeconds: 5
          envFrom:
            - configMapRef:
                name: php-config
          volumeMounts:
            - name: php-ini
              mountPath: /usr/local/etc/php/conf.d/custom.ini
              subPath: custom.ini
      volumes:
        - name: php-ini
          configMap:
            name: php-ini-config

Horizontal Pod Autoscaler

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: php-app-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: php-app
  minReplicas: 3
  maxReplicas: 20
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70
    - type: Resource
      resource:
        name: memory
        target:
          type: Utilization
          averageUtilization: 80

Scaling PHP-FPM

Horizontal Scaling

Factor Consideration
Replicas Start with 3, scale based on CPU/memory metrics
Stateless No local sessions, use Redis/Memcached
Shared storage Use object storage (S3) for uploads
Database Connection pooling, read replicas
Cache Centralized Redis, not per-container

FPM Pool Tuning Per Container

; For containers with 512MB memory limit
pm = dynamic
pm.max_children = 15
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 10
pm.max_requests = 1000

Formula: max_children = (container_memory - overhead) / avg_process_memory

Load Balancing Patterns

Pattern Layer Tool Use Case
Round Robin L4/L7 Nginx, HAProxy Default, equal distribution
Least Connections L4 Nginx, HAProxy Varying request durations
IP Hash L7 Nginx Sticky sessions (avoid if possible)
Weighted L4/L7 Nginx, HAProxy Mixed capacity nodes

Nginx Load Balancer

upstream php-app {
    least_conn;
    server php-1:9000 weight=3;
    server php-2:9000 weight=3;
    server php-3:9000 weight=1 backup;
    keepalive 32;
}

Service Discovery

Platform Mechanism DNS
Docker Compose Built-in DNS Service name resolves to container IP
Docker Swarm VIP + DNS RR Service name resolves to virtual IP
Kubernetes ClusterIP Service service.namespace.svc.cluster.local

Rolling Updates

Zero-Downtime Deployment Checklist

  • [ ] Health checks configured (liveness + readiness)
  • [ ] Graceful shutdown handling (SIGTERM/SIGQUIT)
  • [ ] order: start-first (start new before stopping old)
  • [ ] Connection draining period (stop_grace_period)
  • [ ] Database migrations run before deployment
  • [ ] Backward-compatible API changes
  • [ ] Session persistence via external store

Blue-Green with Docker

# Deploy green alongside blue
docker compose -f docker-compose.green.yml up -d

# Run health checks on green
curl -f http://green.internal/health

# Switch traffic (update nginx upstream)
docker exec nginx nginx -s reload

# Remove blue after verification
docker compose -f docker-compose.blue.yml down

Config and Secret Management

Platform Config Secrets
Compose .env files, environment secrets: (file-based)
Swarm docker config docker secret (encrypted Raft)
Kubernetes ConfigMap Secret (base64, use sealed-secrets)

Detection Patterns

# Find orchestration configurations
Glob: **/docker-stack*.yml
Glob: **/k8s/**/*.yaml
Glob: **/kubernetes/**/*.yaml

# Check for scaling readiness
Grep: "replicas|maxReplicas|scale" --glob "**/*.yml" --glob "**/*.yaml"
Grep: "session.save_handler.*redis" --glob "**/php*.ini"
Grep: "healthcheck|livenessProbe|readinessProbe" --glob "**/*.yml" --glob "**/*.yaml"

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供 Docker Swarm 和 Kubernetes 的完整编排模式
  • 涵盖 PHP 应用负载均衡和自动扩缩容实践
  • 包含零停机部署和蓝绿部署等生产级方案
Trigger Precision95/100

Highlights

  • 触发词精准覆盖 Swarm、Kubernetes、PHP 负载均衡等核心场景
  • 边界清晰,无歧义或重叠风险
Structure and Standards95/100

Areas to improve

  • 缺少 When to Use 章节 Reported severity: Minor

    文档未明确说明适用场景和使用时机

    Recommendation: 建议添加 When to Use 章节,说明何时使用此知识库

  • 部分代码块无语言标识 Reported severity: Minor

    架构图等纯文本 diagram 未标注语言类型

    Recommendation: 为所有代码块添加合适的语言标识(如 plaintext)

Highlights

  • 章节划分清晰,涵盖编排、扩缩容、负载均衡等完整流程
  • 提供端到端示例,包含 Stack 部署、K8s Manifest、Nginx 配置
Execution Reliability90/100

Highlights

  • 工具来源明确,参数配置合理
  • 覆盖健康检查、回滚、优雅关闭等关键异常处理
  • 提供蓝绿部署等生产级变更流程
Evidence Verifiability (mean of the first four)91/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.

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.

  • green.internal

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.