container-security
Container image security scanning, Dockerfile hardening, and ACR image management. Use when scanning container images for vulnerabilities with Trivy…
от julianobarbosa★ 18 звёзд на GitHub
Установить container-security в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Container Image Security
Complete workflow for securing container images: scan, analyze, harden, verify.
Workflow Overview
Import base image to ACR → Build → Scan with Trivy → Analyze CVEs → Harden Dockerfile → Rebuild → Re-scan → Verify
1. Import Base Images to ACR
Avoid Docker Hub rate limits by importing base images into your private ACR. Azure's infrastructure pulls on your behalf — no Docker Hub auth needed.
# Import a public image into ACR
az acr import --name <registry> \
--source docker.io/<image>:<tag> \
--image <local-path>/<image>:<tag>
# Example: import code-server
az acr import --name example-app \
--source docker.io/codercom/code-server:4.107.1 \
--image addons/code-server:4.107.1
# Verify
az acr repository show --name <registry> --repository <local-path>/<image>
Then update the Dockerfile FROM to reference the ACR copy:
# Before (hits Docker Hub rate limits in ACR cloud builds)
FROM codercom/code-server:latest
# After (pulls from local ACR — no rate limit)
FROM example-app.azurecr.io/addons/code-server:4.107.1
Important: ACR cloud builds (az acr build) are unauthenticated against Docker Hub. Any FROM referencing Docker Hub will eventually hit rate limits. Always import first.
2. Build with ACR
az acr build --registry <registry> --image <repo>:<tag> -f Dockerfile .
ACR builder limitations — these Docker features are NOT supported:
COPY <<'EOF'heredoc syntax (BuildKit-only) — useRUN printforRUN catinstead- Multi-platform builds require
--platformflag - BuildKit-specific
RUN --mountdirectives
3. Scan with Trivy
Option A: Trivy via ACR Task (recommended for CI)
First, import Trivy itself into ACR (once):
az acr import --name <registry> \
--source docker.io/aquasec/trivy:latest \
--image tools/trivy:latest
Then scan:
# Table format for human review
az acr run --registry <registry> \
--cmd "<registry>.azurecr.io/tools/trivy:latest image \
--severity HIGH,CRITICAL \
<registry>.azurecr.io/<image>:<tag>" /dev/null
# JSON format for programmatic analysis
az acr run --registry <registry> \
--cmd "<registry>.azurecr.io/tools/trivy:latest image \
--severity HIGH,CRITICAL --format json \
<registry>.azurecr.io/<image>:<tag>" /dev/null
Option B: Trivy locally (requires Docker daemon)
az acr login --name <registry>
trivy image --severity HIGH,CRITICAL <registry>.azurecr.io/<image>:<tag>
Option C: Trivy on local Dockerfile (no build needed)
trivy config --severity HIGH,CRITICAL,MEDIUM Dockerfile
4. Analyze CVE Findings
Categorize every CRITICAL and HIGH finding:
| Category | Action | Example |
|---|---|---|
| Fixable by us | Pin newer version in Dockerfile | Tool binary built with old Go stdlib |
| Fixable upstream | Track, document, revisit | Base image ships vulnerable internal dep |
| OS-level, patch pending | Document, monitor Debian/Ubuntu tracker | libsqlite3, openssl |
| will_not_fix | Accept risk or find alternative package | zlib1g in Debian |
For JSON output, extract CRITICAL summary:
import json
data = json.load(open('trivy-results.json'))
for result in data.get('Results', []):
for v in result.get('Vulnerabilities', []):
if v.get('Severity') == 'CRITICAL':
print(f"{v['VulnerabilityID']} | {v['PkgName']} {v.get('InstalledVersion','')} | fix: {v.get('FixedVersion','')} | {v.get('Status','')}")
5. Dockerfile Hardening Checklist
Version Pinning (eliminates reproducibility CVEs)
# Bad — unpinned, non-reproducible, may pull vulnerable versions
FROM image:latest
RUN curl .../releases/latest/download/tool | bash
# Good — pinned, reproducible, auditable
FROM registry.azurecr.io/addons/image:4.107.1
ARG TOOL_VERSION=v1.2.3
RUN curl -fsSL "https://github.com/org/tool/releases/download/${TOOL_VERSION}/tool_linux_amd64.tar.gz" \
| tar xz -C /usr/local/bin tool
Use ARG for version variables — makes updates a single-line change and is visible in docker history.
SSH Hardening
# Disable password auth, enable key-based only
RUN mkdir -p /run/sshd && \
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && \
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config && \
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config && \
echo "AllowUsers <user>" >> /etc/ssh/sshd_config && \
ssh-keygen -A && \
mkdir -p /home/<user>/.ssh && \
chmod 700 /home/<user>/.ssh && \
chown <user>:<user> /home/<user>/.ssh
Non-root Runtime
# Start privileged services as root, then drop privileges
RUN printf '#!/bin/bash\nset -e\n/usr/sbin/sshd\nexec su - <user> -c "<main-process>"\n' \
> /usr/local/bin/entrypoint.sh && \
chmod +x /usr/local/
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Read - 02
Bash - 03
Grep - 04
Glob - 05
Edit - 06
Write - 07
Agent - 08
WebSearch
Вложенные файлы
- evals/evals.json
FAQ
Что делает скилл container-security?
Container image security scanning, Dockerfile hardening, and ACR image management. Use when scanning container images for vulnerabilities with Trivy, hardening Dockerfiles (pinning versions, non-root runtime, SSH config), importing images to Azure Container Registry to avoid Docker Hub rate limits, or analyzing CVE findings. Also trigger when the user mentions image security, vulnerability scanning, CVE remediation, container hardening, Trivy scan, Docker security, or ACR image import — even if they don't explicitly say "container security".
Как установить скилл container-security?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл container-security запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
AnthropicThe scan that the plugin's GitHub Action runs.
azure-static-web-apps
GitHubHelps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
ai-ready
GitHubMake any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
aws-cdk-python-setup
GitHubSetup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…