Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计异常

security-docker安全 Docker

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

1,626

周安装

51

GitHub Stars

110

下载量

420
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:security-docker(安全 Docker)
来源仓库:https://github.com/igorwarzocha/opencode-workflows
仓库路径:skills/security-docker
安装命令:
npx skills add https://github.com/igorwarzocha/opencode-workflows --skill security-docker
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/igorwarzocha/opencode-workflows --skill security-docker

简介

用于 Docker 容器安全与部署支持。

  • 适合检查配置风险和权限设置。security-docker 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 可生成安全复核清单或排障思路。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。
  • 安装方式:通过 npx 从 GitHub 仓库添加技能。
  • 涉及资源修改时应先确认影响范围。

SKILL.md

Security audit patterns for Docker and container deployments covering secrets in images, port exposure, user privileges, and compose security.

Secrets in Images (Critical)

Secrets in Build Args/ENV

# ❌ CRITICAL: Secret in ENV (visible in image history)
ENV API_KEY=sk_live_abc123
ENV DATABASE_URL=postgres://user:password@host/db

# ❌ CRITICAL: Secret in ARG (visible in image history)
ARG AWS_SECRET_ACCESS_KEY
RUN aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY

# ✓ Use runtime secrets
# Pass via docker run -e or docker-compose environment/env_file

# ✓ Docker secrets (Swarm) or orchestrator-specific secrets
# Use /run/secrets/* instead of ENV/ARG when available

Secrets Baked into Layers

# ❌ CRITICAL: Even if deleted, secret is in layer history
COPY .env /app/.env
RUN source /app/.env && do_something
RUN rm /app/.env  # Still in previous layer!

# ❌ CRITICAL: Copying all files includes secrets
COPY . /app/  # Copies .env, .git, etc.

# ✓ Use .dockerignore
# In .dockerignore:
# .env*
# .git
# *.pem
# *.key

# ✓ Or explicit COPY
COPY package*.json /app/
COPY src/ /app/src/

Checking Image History

# Audit existing images for secrets
docker history --no-trunc <image>
docker inspect <image> | jq '.[0].Config.Env'

Port Exposure

docker-compose.yml

# ❌ CRITICAL: Database exposed to host network
services:
  db:
    image: postgres
    ports:
      - "5432:5432"  # Accessible from outside!

# ❌ CRITICAL: Redis without password
  redis:
    image: redis
    ports:
      - "6379:6379"  # And no AUTH!

# ✓ Internal only (accessible to other containers)
services:
  db:
    image: postgres
    expose:
      - "5432"  # Only internal
    # No 'ports' = not exposed to host

# ✓ If must expose, bind to localhost
  db:
    ports:
      - "127.0.0.1:5432:5432"  # Only localhost

Default Credentials

# ❌ No password or default password
services:
  db:
    image: postgres
    environment:
      POSTGRES_PASSWORD: postgres  # Default!

  redis:
    image: redis
    # No password at all

# ✓ Strong passwords from secrets
services:
  db:
    image: postgres
    environment:
      POSTGRES_PASSWORD_FILE: /run/secrets/db_password
    secrets:
      - db_password

secrets:
  db_password:
    file: ./secrets/db_password.txt  # MUST NOT be in git!

Non-Root User

# ❌ Running as root (default)
FROM node:18
COPY . /app
CMD ["node", "server.js"]  # Runs as root

# ✓ Create and use non-root user
FROM node:18
WORKDIR /app
COPY --chown=node:node . .
USER node
CMD ["node", "server.js"]

# ✓ Using numeric UID (more portable)
FROM node:18
RUN useradd -r -u 1001 appuser
WORKDIR /app
COPY --chown=1001:1001 . .
USER 1001
CMD ["node", "server.js"]

Multi-Stage Builds

# ❌ Build tools and secrets in final image
FROM node:18
COPY . .
RUN npm install
RUN npm run build
CMD ["node", "dist/server.js"]
# Final image has: source, node_modules (dev deps), build tools

# ✓ Multi-stage: only production artifacts
FROM node:18 AS builder
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
RUN npm run build

FROM node:18-slim AS production
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
USER node
CMD ["node", "dist/server.js"]
# Final image: minimal, no source, no build tools

Docker Compose Security

Privileged Mode

# ❌ CRITICAL: Full host access
services:
  app:
    privileged: true  # Container can do anything on host!

# ❌ HIGH: Dangerous capabilities
services:
  app:
    cap_add:
      - SYS_ADMIN
      - NET_ADMIN

Volume Mounts

# ❌ CRITICAL: Docker socket access = root on host
services:
  app:
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

# ❌ HIGH: Sensitive host paths
services:
  app:
    volumes:
      - /etc:/etc
      - /root:/root

Network Mode

# ❌ HIGH: Host network mode
services:
  app:
    network_mode: host  # Bypasses Docker network isolation

Image Security

Base Image

# ❌ Outdated or unverified
FROM node:14  # EOL version
FROM random-user/node-app  # Unverified

# ✓ Official, recent, minimal
FROM node:20-slim
FROM node:20-alpine

Image Scanning

# Scan for vulnerabilities
docker scout cves <image>
trivy image <image>
grype <image>

Quick Audit Commands

# Find secrets in Dockerfile
rg "(ENV|ARG).*(KEY|SECRET|PASSWORD|TOKEN)" Dockerfile*

# Find exposed ports in compose
rg "ports:" docker-compose*.yml -A 3

# Check for privileged/capabilities
rg "(privileged|cap_add|network_mode)" docker-compose*.yml

# Check for docker.sock mount
rg "docker.sock" docker-compose*.yml

# Check for USER instruction
grep "^USER" Dockerfile

# Check .dockerignore exists and has secrets
cat .dockerignore | grep -E "(env|key|secret|pem)"

Hardening Checklist

  • No secrets in ENV/ARG instructions
  • No secrets COPY'd into image
  • .dockerignore excludes.env,.git, *.pem, *.key
  • Database/Redis ports not exposed to host (or only 127.0.0.1)
  • Strong passwords for all services (not defaults)
  • USER instruction sets non-root user
  • Multi-stage build for production images
  • No privileged: true
  • No docker.sock mount (unless required)
  • Base images are official and recent
  • Images scanned for vulnerabilities

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.53%
按下载量换算120

OpenCode

24.92%
按下载量换算105

Antigravity

19.26%
按下载量换算81

windsurf

11.42%
按下载量换算48

Gemini CLI

7.79%
按下载量换算33

Codex

3.44%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills