docker-scanning-knowledge

Docker 镜像扫描知识库,针对 PHP 容器镜像提供漏洞检测、合规性检查和生成软件物料清单(SBOM)的功能说明与指导。

仓库最近推送
GitHub Stars
109
Forks
26
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "docker-scanning-knowledge":https://skillpi.com/zh/skills/deepskill-b5969edc22d6043483254d38f2cbff497d2b8b28b38afada38675be0e7f4c6f8。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

Docker 镜像扫描知识库,针对 PHP 容器镜像提供漏洞检测、合规性检查和生成软件物料清单(SBOM)的功能说明与指导。

0 下载

介绍来源: third_party · dykyi-roman · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: docker-scanning-knowledge
description: Docker image scanning knowledge base. Provides vulnerability detection, compliance checking, and SBOM generation for PHP container images.

Docker Image Scanning Knowledge Base

Quick reference for vulnerability scanning and compliance checking in PHP container images.

Scanning Tools Comparison

Tool Type License Strengths
Trivy CLI, CI, Operator Apache 2.0 OS + app deps, IaC, SBOM, fast
Grype CLI, CI Apache 2.0 Fast, Syft integration, accurate
Snyk CLI, CI, IDE, Web Commercial Deep analysis, fix suggestions
Docker Scout CLI, Desktop Commercial Docker-native, real-time, policy

Trivy

Basic Scanning

# Scan image for vulnerabilities
trivy image myapp:latest

# Scan with severity filter
trivy image --severity HIGH,CRITICAL myapp:latest

# Scan and fail on threshold (for CI)
trivy image --exit-code 1 --severity CRITICAL myapp:latest

# Scan with specific format
trivy image --format json --output results.json myapp:latest
trivy image --format table myapp:latest
trivy image --format sarif --output results.sarif myapp:latest

Scanning Dockerfile

# Scan Dockerfile for misconfigurations
trivy config Dockerfile

# Scan entire project config
trivy config .

SBOM Generation

# Generate SBOM in CycloneDX format
trivy image --format cyclonedx --output sbom.json myapp:latest

# Generate SBOM in SPDX format
trivy image --format spdx-json --output sbom.spdx.json myapp:latest

Grype

Basic Scanning

# Scan image
grype myapp:latest

# Fail on severity
grype myapp:latest --fail-on high

# Output as JSON
grype myapp:latest -o json > results.json

# Scan from SBOM
syft myapp:latest -o spdx-json > sbom.json
grype sbom:sbom.json

Syft SBOM Generation

# Generate SBOM with Syft
syft myapp:latest -o cyclonedx-json > sbom.cyclonedx.json
syft myapp:latest -o spdx-json > sbom.spdx.json
syft myapp:latest -o table

Docker Scout

# Analyze image vulnerabilities
docker scout cves myapp:latest

# Get fix recommendations
docker scout recommendations myapp:latest

# Compare two images
docker scout compare myapp:latest myapp:previous

# View SBOM
docker scout sbom myapp:latest

CI Integration Patterns

GitHub Actions

name: Security Scan

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build image
        run: docker build -t myapp:${{ github.sha }} .

      - name: Trivy vulnerability scan
        uses: aquasecurity/trivy-action@master
        with:
          image-ref: myapp:${{ github.sha }}
          format: sarif
          output: trivy-results.sarif
          severity: CRITICAL,HIGH
          exit-code: 1

      - name: Upload scan results
        uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: trivy-results.sarif

      - name: Generate SBOM
        uses: aquasecurity/trivy-action@master
        with:
          image-ref: myapp:${{ github.sha }}
          format: cyclonedx
          output: sbom.json

      - name: Upload SBOM
        uses: actions/upload-artifact@v4
        with:
          name: sbom
          path: sbom.json

GitLab CI

container_scanning:
  stage: test
  image:
    name: aquasec/trivy:latest
    entrypoint: [""]
  variables:
    IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  script:
    - trivy image --exit-code 0 --format template --template "@/contrib/gitlab.tpl" --output gl-container-scanning-report.json $IMAGE
    - trivy image --exit-code 1 --severity CRITICAL $IMAGE
  artifacts:
    reports:
      container_scanning: gl-container-scanning-report.json
  allow_failure: false

SBOM Formats

Format Standard Use Case
CycloneDX OWASP Security-focused, VEX support
SPDX Linux Foundation License compliance, legal
Syft JSON Anchore Tool-specific, detailed

PHP-Specific SBOM Content

An SBOM for a PHP container should include:

Component Source Example
OS packages Alpine apk / Debian apt libzip, icu-libs
PHP extensions docker-php-ext-install pdo_mysql, opcache
Composer packages composer.lock symfony/http-kernel
Node packages package-lock.json Build-time only
Binary tools Installed in Dockerfile composer, nginx

Compliance Policies

Severity Classification

Severity CVSS Action SLA
Critical 9.0-10.0 Block deployment, fix immediately 24 hours
High 7.0-8.9 Block deployment, prioritize fix 7 days
Medium 4.0-6.9 Allow deployment, schedule fix 30 days
Low 0.1-3.9 Allow deployment, backlog 90 days
Negligible 0.0 Allow deployment, info only N/A

Policy Configuration (Trivy)

# .trivy.yaml
severity:
  - CRITICAL
  - HIGH

exit-code: 1

ignore-unfixed: true

ignorefile: .trivyignore
# .trivyignore
# Accepted risks with justification
CVE-2023-XXXXX  # Mitigated by WAF rules, not exploitable in our context
CVE-2023-YYYYY  # Fix not available, monitoring for update

Fix Strategies

Strategy When Example
Upgrade base image OS-level CVE FROM php:8.4-fpm-alpine3.20
Update PHP version PHP CVE FROM php:8.4.3-fpm-alpine
Update Composer deps Library CVE composer update --with-dependencies
Pin fixed version Specific package apk add libcurl=8.5.0-r0
Remove package Unnecessary dep Remove from Dockerfile
Accept risk No fix available Document in .trivyignore

Automated Scanning Workflow

+---------------------------------------------------------------------------+
|                    SCANNING WORKFLOW                                        |
+---------------------------------------------------------------------------+
|                                                                            |
|   Developer Push                                                           |
|       |                                                                    |
|       v                                                                    |
|   Build Image --> Scan Image --> Generate SBOM --> Policy Check             |
|       |               |               |               |                    |
|       |          +----+----+          |          +----+----+               |
|       |          | Pass    | Fail     |          | Pass    | Fail          |
|       |          v         v          |          v         v               |
|       |       Continue   Block PR     |       Deploy    Block Deploy       |
|       |          |                    |          |                          |
|       v          v                    v          v                          |
|   Push to    Merge to            Store SBOM   Production                   |
|   Registry   Main Branch         in Registry  Monitoring                   |
|                                                                            |
+---------------------------------------------------------------------------+

Detection Patterns

# Find scanning configurations
Glob: **/.trivy.yaml
Glob: **/.trivyignore
Glob: **/.grype.yaml
Glob: **/.snyk

# Check CI for scanning steps
Grep: "trivy|grype|snyk|docker scout" --glob "**/.github/workflows/*.yml"
Grep: "container_scanning|security_scan" --glob "**/.gitlab-ci.yml"

# Find SBOM artifacts
Glob: **/sbom*.json
Glob: **/*.spdx.json
Glob: **/*.cyclonedx.json

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 提供 Docker 镜像扫描的完整知识库,涵盖漏洞检测、合规性检查和 SBOM 生成
触发精准95/100

亮点

  • 触发词精准完整,覆盖多种变体,边界清晰
结构规范95/100

亮点

  • Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整
执行可靠90/100

亮点

  • 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制
证据可验 (前四项均值)93/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。