Docker Patterns 标志

Docker Patterns

社区
brucesongs
docker-patterns

Setting up a practice lab for penetration testing techniques - Creating isolated environments for exploit development and testing - Building vulnerable application targets for training - Testing tools against known-vulnerable configurations - User says "lab", "docker lab.

概览

发布者brucesongs
代码仓库kali-claw
技能名称docker-patterns
星标数
70
复刻数
18
附带文件
12
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 12 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 brucesongs 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Docker Patterns AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/brucesongs/kali-claw/tree/main/skills/docker-patterns
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/brucesongs/kali-claw.git /tmp/kali-claw
mkdir -p .claude/skills
cp -r /tmp/kali-claw/skills/docker-patterns .claude/skills/docker-patterns
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Docker Patterns,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Docker Patterns。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Docker Patterns 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Docker Patterns for Security Testing

Supplementary Files:

  • payloads.md — Quick launch commands, additional lab configurations, evidence extraction patterns, and cleanup commands
  • test-cases.md — Structured test cases for lab deployment, attack chain setup, evidence extraction, and safety verification

Summary

Docker Patterns skill domain covering infrastructure operations.

Domain: infrastructure

Use Cases

  1. Vulnerable Web App Lab — Deploy intentionally vulnerable applications (DVWA, WebGoat, Juice Shop) for safe practice
  2. Network Pentest Lab — Create multi-host network environments with routers, firewalls, and services for lateral movement practice
  3. Attack Chain Lab — Build complete kill chain scenarios (initial access → persistence → exfiltration) in isolated containers
  4. Disposable Testing — Spin up and tear down test environments without affecting host system or production infrastructure
  5. Tool Validation — Test new security tools and exploits in a known, controlled environment before engagement use

Activation

  • Setting up a practice lab for penetration testing techniques
  • Creating isolated environments for exploit development and testing
  • Building vulnerable application targets for training
  • Testing tools against known-vulnerable configurations
  • User says "lab", "docker lab", "test environment", "practice target"

Core Principle

Never test attack techniques against systems you don't own or have explicit authorization to test. Docker labs provide safe, legal environments for security practice and tool validation.

All lab environments bind to 127.0.0.1 only — never expose on public interfaces.

Pattern 1: Vulnerable Web App Lab

DVWA (Damn Vulnerable Web Application)

yaml
# docker-compose.dvwa.yml
version: '3.8'
services:
  dvwa:
    image: vulnerables/web-dvwa:latest
    ports:
      - "127.0.0.1:8080:80"
    environment:
      - DB_PASSWORD=p@ssw0rd
    restart: unless-stopped

Practice targets: SQL injection, XSS, CSRF, Command Injection, File Upload, LFI/RFI

SQLi-Labs

yaml
# docker-compose.sqli-labs.yml
version: '3.8'
services:
  sqli-labs:
    image: acgpiano/sqli-labs:latest
    ports:
      - "127.0.0.1:8081:80"
    restart: unless-stopped

Practice targets: Error-based SQLi, Blind SQLi, UNION-based SQLi, Time-based SQLi

OWASP Juice Shop

yaml
# docker-compose.juice-shop.yml
version: '3.8'
services:
  juice-shop:
    image: bkimminich/juice-shop:latest
    ports:
      - "127.0.0.1:8082:3000"
    restart: unless-stopped

Practice targets: Full OWASP Top 10 coverage, API security, XSS, JWT attacks, access control

Pattern 2: Network Pentest Lab

Multi-Service Network Lab

yaml
# docker-compose.network-lab.yml
version: '3.8'
services:
  # Target: Vulnerable SSH server
  target-ssh:
    image: rastasheep/ubuntu-sshd:18.04
    ports:
      - "127.0.0.1:2222:22"
    networks:
      - lab-net

  # Target: Vulnerable FTP server
  target-ftp:
    image: stilliard/pure-ftpd:latest
    ports:
      - "127.0.0.1:2121:21"
      - "127.0.0.1:30000-30009:30000-30009"
    environment:
      - PUBLICHOST=localhost
    networks:
      - lab-net

  # Target: Web server with vulnerabilities
  target-web:
    image: php:8.1-apache
    ports:
      - "127.0.0.1:8083:80"
    volumes:
      - ./vulnerable-app:/var/www/html
    networks:
      - lab-net

  # Attacker machine (Kali tools)
  attacker:
    image: kalilinux/kali-rolling:latest
    networks:
      - lab-net
    command: tail -f /dev/null  # Keep alive
    cap_add:
      - NET_ADMIN

networks:
  lab-net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.28.0.0/16

Practice targets: Network enumeration, service identification, SSH brute force, FTP attacks, web app attacks

Pattern 3: Multi-Stage Attack Chain Lab

Simulates a realistic attack chain across multiple vulnerable services:

yaml
# docker-compose.attack-chain.yml
version: '3.8'
services:
  # Stage 1: External-facing web app (initial access)
  web-frontend:
    build: ./scenarios/web-frontend
    ports:
      - "127.0.0.1:9000:80"
    networks:
      - dmz
    depends_on:
      - web-api

  # Stage 2: Internal API (lateral movement target)
  web-api:
    build: ./scenarios/web-api
    ports:
      - "127.0.0.1:9001:8080"
    networks:
      - dmz
      - internal
    environment:
      - DB_HOST=database
      - DB_PASS=weakpassword123

  # Stage 3: Database (data target)
  database:
    image: mysql:5.7
    networks:
      - internal
    environment:
      - MYSQL_ROOT_PASSWORD=weakpassword123
      - MYSQL_DATABASE=secrets
    volumes:
      - ./scenarios/db-init:/docker-entrypoint-initdb.d

  # Stage 4: Internal admin panel (privilege escalation)
  admin-panel:
    build: ./scenarios/admin-panel
    networks:
      - internal
    environment:
      - ADMIN_USER=admin
      - ADMIN_PASS=admin123

networks:
  dmz:
    driver: bridge
    ipam:
      config:
        - subnet: 172.29.0.0/16
  internal:
    driver: bridge
    ipam:
      config:
        - subnet: 172.30.0.0/16
    internal: true  # No external access

Practice targets: Multi-stage exploitation, lateral movement, privilege escalation, data exfiltration

Pattern 4: Disposable Testing

Quick spin-up for single-tool testing:

bash
# One-liner for testing a specific tool against a specific image
docker run --rm -it --network=host kalilinux/kali-rolling:latest \
  bash -c "apt update && apt install -y nmap && nmap -sV 127.0.0.1"

# Temporary vulnerable target
docker run --rm -d -p 127.0.0.1:9999:80 vulnerables/web-dvwa:latest

# Test and destroy
docker stop $(docker ps -q --filter publish=9999)

Rules:

  • Always use --rm for auto-cleanup
  • Always bind to 127.0.0.1
  • Never persist sensitive data from test containers

Pattern 5: Tool Testing Environment

Validate tool behavior against known-vulnerable targets:

yaml
# docker-compose.tool-test.yml
version: '3.8'
services:
  # Known-vulnerable target for tool calibration
  target:
    image: vulnerables/web-dvwa:latest
    ports:
      - "127.0.0.1:9090:80"

  # Tool under test
  tool-test:
    image: kalilinux/kali-rolling:latest
    network_mode: "host"
    command: tail -f /dev/null
    volumes:
      - ./test-results:/results

Safety Rules

  1. Bind to localhost only — All port mappings use 127.0.0.1:port:container_port
  2. No persistent sensitive data — Use --rm or anonymous volumes
  3. Isolated networks — Lab networks should not overlap with production
  4. Resource limits — Set memory and CPU limits to prevent runaway containers
  5. Cleanup after use — docker compose down -v to remove containers and volumes
bash
# Full cleanup
docker compose -f docker-compose.lab.yml down -v --rmi local
docker system prune -f

Integration with Other Skills

SkillDocker PatternApplication
web-sqliPattern 1 (DVWA/SQLi-Labs)Practice SQL injection techniques safely
web-xssPattern 1 (DVWA/Juice Shop)Practice XSS payload crafting
web-auth-bypassPattern 1 (Juice Shop)Practice authentication attack techniques
network-pentestPattern 2 (Network Lab)Practice network enumeration and service exploitation
post-exploitationPattern 3 (Attack Chain)Practice lateral movement and privilege escalation
verification-loopPattern 5 (Tool Test)Verify tool accuracy against known vulnerabilities
autonomous-loopsPattern 4 (Disposable)Quick test loops against disposable targets
terminal-opsAll patternsEvidence protocol for all lab activities

Quick Start

bash
# Start DVWA lab
cd ~/.openclaw/workspace-kali-claw/skills/docker-patterns/
docker compose -f configs/docker-compose.dvwa.yml up -d

# Access DVWA
# http://127.0.0.1:8080 (admin/password)

# Stop and clean up
docker compose -f configs/docker-compose.dvwa.yml down -v

Detection Methods

Docker Daemon Audit

  • Anomalous docker commands: docker run --privileged, docker run -v /:/host from non-CI sources.
  • Container escape attempts: Processes accessing /proc/1/root, cgroup manipulation from inside container.
  • Privileged container abuse: Syslog Event 1 for dockerd with --privileged; CAP_SYS_ADMIN use.

SIEM Detection Rules

  • Splunk SPL: index=docker command="run" | where match(args, "privileged|/etc:/etc|/var/run/docker.sock")
  • Falco rule: Launching privileged container / Container launched with host path mount
  • Sysdig Secure / Aqua: Container runtime security platform detections.

Defense Evasion Techniques

Container Escape Stealth

  • Use existing capabilities: Don't escalate to privileged; abuse existing CAP_SYS_ADMIN if present.
  • Sidecar injection: Inject into existing pod rather than creating new container (Kubernetes).
  • Mount docker socket: Mount /var/run/docker.sock (often permitted in CI); spawn sibling container.
  • Avoid syscall monitoring: Use memfd_create for memory-only execution.

Image Stealth

  • Cosign signature theft: Steal signing key; sign malicious image as legitimate.
  • Multi-layer obfuscation: Hide payload in lower image layers; evade simple scanners.
  • Admission controller bypass: Modify MutatingWebhookConfiguration to allowlist malicious images.

Anti-Patterns

  • Binding to 0.0.0.0 — Never expose lab services on all interfaces
  • Using default passwords in production — Lab passwords stay in the lab
  • Running without resource limits — Containers can consume all host resources
  • Mixing lab and production networks — Keep lab traffic isolated
  • Skipping cleanup — Always remove containers and volumes after testing

Orchestration

ECC Loop Pattern

  • Pattern: Sequential Pipeline (create lab → deploy → test → extract evidence → cleanup)
  • Rationale: Lab environments follow a strict lifecycle — each phase must complete before the next begins, and cleanup is mandatory
  • Integration: All security skills that need practice environments (web-sqli, web-xss, network-pentest, post-exploitation), terminal-ops (evidence capture), safety-guard (localhost-only enforcement)

Cross-Skill Pipeline

docker-patterns → [any attack skill] → verification-loop → terminal-ops (evidence)
       ↓                                                          ↑
  safety-guard (verify isolation)                autonomous-loops (disposable targets)

Quality Gate

  • Pre-condition: Docker available, ports free, no public interface bindings
  • Post-condition: All containers removed, all volumes cleaned, no ports listening
  • Verification: docker ps returns empty, no lab ports in ss -tlnp

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Docker Patterns AI 技能有什么作用?

Setting up a practice lab for penetration testing techniques - Creating isolated environments for exploit development and testing - Building vulnerable application targets for training - Testing tools against known-vulnerable configurations - User says "lab", "docker lab.

为什么在 TypingMind 中使用 Docker Patterns?

因为您只需安装一次,就能搭配任何模型使用。Docker Patterns 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Docker Patterns?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/brucesongs/kali-claw/tree/main/skills/docker-patterns。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Docker Patterns?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Docker Patterns 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Docker Patterns 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Docker Patterns AI 技能免费吗?

是的。brucesongs 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇