Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Docker Configuration Validator

БесплатноБез исполняемых скриптовНе проверен

Comprehensive Docker and Docker Compose validation following best practices and security standards. Use this skill when users ask to validate Dockerfiles…

rknallот rknall★ 94 звезды на GitHub19 установок в других каталогах

Об этом скилле

Docker Configuration Validator

This skill provides comprehensive validation for Dockerfiles and Docker Compose files, ensuring compliance with best practices, security standards, and modern syntax requirements.

When to Use This Skill

Activate this skill when the user requests:

  • Validate Dockerfiles or Docker Compose files
  • Review Docker configurations for best practices
  • Check for Docker security issues
  • Verify multi-stage build implementation
  • Audit Docker setup for production readiness
  • Ensure modern Docker Compose syntax compliance
  • Fix Docker configuration issues
  • Create validation scripts or CI/CD integration

Core Workflow

Phase 1: Initial Assessment

When a user requests Docker validation, start by understanding the scope:

  1. Identify What to Validate

    • Single Dockerfile or multiple?
    • Docker Compose file(s)?
    • Entire project directory?
    • Specific concerns or focus areas?
    • Production vs development environment?
  2. Understand Requirements

    • Security compliance level needed?
    • Multi-stage build requirement?
    • Performance constraints?
    • CI/CD integration needed?
    • Automated validation script desired?
  3. Check Available Tools

    • Is Hadolint available? (Dockerfile linter)
    • Is DCLint available? (Docker Compose linter)
    • Is Docker CLI available?
    • Should tools be installed as part of process?

Phase 2: Dockerfile Validation

Step 1: Locate Dockerfiles

Find all Dockerfiles in the project:

find . -type f \( -name "Dockerfile*" ! -name "*.md" \)

Step 2: Run Hadolint Validation

If Hadolint is available:

# Validate each Dockerfile
hadolint Dockerfile

# JSON output for programmatic analysis
hadolint --format json Dockerfile

# Set failure threshold
hadolint --failure-threshold error Dockerfile

If Hadolint is NOT available:

  • Perform manual validation using built-in checks (see Step 3)
  • Recommend Hadolint installation
  • Provide installation instructions

Step 3: Manual Dockerfile Validation

Check each Dockerfile for critical issues:

1. Base Image Best Practices

  • ✅ Check: No :latest tags
  • ✅ Check: Specific version pinned
  • ✅ Check: Uses minimal base images (alpine/slim variants)
  • ✅ Check: Trusted registry used

2. Multi-Stage Build Verification

# Count FROM statements (should be >= 2 for multi-stage)
FROM_COUNT=$(grep -c "^FROM " Dockerfile)

# Check for named stages
NAMED_STAGES=$(grep -c "^FROM .* AS " Dockerfile)

# Check for inter-stage copies
COPY_FROM=$(grep -c "COPY --from=" Dockerfile)

Analysis:

  • If FROM_COUNT >= 2: Multi-stage build detected ✅
  • If COPY_FROM == 0 and FROM_COUNT >= 2: Warning - artifacts may not be transferred
  • If FROM_COUNT == 1: Single-stage build - recommend multi-stage for optimization

3. Security Checks

  • ✅ Check: USER directive present (non-root)
  • ✅ Check: Last USER is not root
  • ✅ Check: No secrets in Dockerfile
  • ✅ Check: WORKDIR uses absolute paths
  • ✅ Check: No unnecessary privileges

4. Layer Optimization

  • ✅ Check: Combined RUN commands
  • ✅ Check: Package manager cache cleaned
  • ✅ Check: COPY before RUN for better caching
  • ✅ Check: .dockerignore file exists

5. Best Practices

  • ✅ Check: HEALTHCHECK defined
  • ✅ Check: WORKDIR used (not cd)
  • ✅ Check: COPY preferred over ADD
  • ✅ Check: CMD/ENTRYPOINT uses JSON notation
  • ✅ Check: Labels included (maintainer, version)

Step 4: Dockerfile Issue Classification

Classify findings by severity:

CRITICAL (Must Fix):

  • Running as root user
  • Using :latest tags
  • Secrets exposed in image
  • Invalid syntax

HIGH (Should Fix):

  • No multi-stage build when applicable
  • No HEALTHCHECK
  • Package versions not pinned
  • Security vulnerabilities

MEDIUM (Recommended):

  • Using ADD instead of COPY
  • Not cleaning package cache
  • Missing labels
  • Inefficient layer structure

LOW (Nice to Have):

  • Could use slimmer base image
  • Could combine more RUN commands
  • Could improve comments

Phase 3: Docker Compose Validation

Step 1: Locate Compose Files

Find all Docker Compose files:

find . -maxdepth 3 -type f \( -name "docker-compose*.yml" -o -name "docker-compose*.yaml" -o -name "compose*.yml" \)

Step 2: Check for Obsolete Version Field

CRITICAL CHECK: Modern Docker Compose (v2.27.0+) does NOT use version field

# Check for obsolete version field
if grep -q "^version:" docker-compose.yml; then
    echo "❌ ERROR: Found obsolete 'version' field"
    echo "Remove 'version:' line - it's obsolete in Compose v2.27.0+"
fi

Old (Deprecated):

version: '3.8'  # ❌ REMOVE THIS
services:
  web:
    image: nginx:latest

New (Modern):

# No version field!
services:
  web:
    image: nginx:1.24-alpine

Step 3: Built-in Docker Compose Validation

# Syntax validation
docker compose config --quiet

# Show resolved configuration
docker compose config

# Validate specific file
docker
Полный SKILL.md на GitHub

Установить Docker Configuration Validator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

README.mdtool-installation.mdvalidation-checklist.md

FAQ

Что делает скилл Docker Configuration Validator?

Comprehensive Docker and Docker Compose validation following best practices and security standards. Use this skill when users ask to validate Dockerfiles, review Docker configurations, check Docker Compose files, verify multi-stage builds, audit Docker security, or ensure compliance with Docker best practices. Validates syntax, security, multi-stage builds, and modern Docker Compose requirements.

Как установить скилл Docker Configuration Validator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Docker Configuration Validator запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Docker Configuration Validator с