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.
Version: 1.0.0 Category: Development Description: Comprehensive Docker and Docker Compose validation following best practices and security standards
The Docker Configuration Validator skill provides expert-level validation of Dockerfiles and Docker Compose files, ensuring your Docker configurations follow modern best practices, security standards, and syntax requirements. This skill automates the validation process, identifies issues, and provides specific, actionable fixes.
version field (Compose v2.27.0+):latest tags and unpinned versionsUse this skill when you need to:
The skill starts by understanding what you need validated:
Performs multi-layered validation:
Categorizes findings by severity:
Generates comprehensive reports including:
Can create:
docker --version # Should be 20.10+
docker compose version # Should be v2.27.0+
Hadolint: Dockerfile linter (highly recommended)
# macOS
brew install hadolint
# Linux
wget -O /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
chmod +x /usr/local/bin/hadolint
# Verify
hadolint --version
DCLint: Docker Compose linter (recommended)
# Install via npm
npm install -g docker-compose-linter
# Verify
dclint --version
Note: The skill can perform validation even without these tools, but they significantly enhance the validation quality.
User: "Can you validate my Dockerfile?"
Claude: "I'll validate your Dockerfile for best practices and security. Let me check..."
[Claude performs comprehensive validation and provides detailed report]
User: "Check my docker-compose.yml for issues"
Claude: "I'll validate your Docker Compose file. Checking for modern syntax compliance..."
[Claude identifies obsolete version field and other issues]
"❌ CRITICAL: Found obsolete 'version' field. This is deprecated in Compose v2.27.0+.
Remove the 'version: 3.8' line from your compose file."
User: "Audit all Docker configs in my project for production readiness"
Claude: "I'll perform a comprehensive audit of all Dockerfiles and Compose files..."
[Claude validates all files and generates full security and best practices report]
User: "Create a validation script I can run in CI/CD"
Claude: "I'll create a comprehensive validation script with CI/CD integration..."
[Claude generates bash script + GitHub Actions workflow]
:latest tags → Pin specific versionsversion: field present → REMOVE (obsolete):latest tags → Pin specific versions# Docker Configuration Validation Report
## Executive Summary
- Total Dockerfiles: 3
- Total Compose Files: 1
- Critical Issues: 2
- High Priority: 4
- Status: ⚠️ REQUIRES FIXES
## Critical Issues
1. Dockerfile (line 1): Using :latest tag
Fix: FROM node:20-bullseye
Impact: Unpredictable builds
2. docker-compose.yml (line 1): Obsolete version field
Fix: Remove 'version: 3.8' line
Impact: Using deprecated syntax
## Recommendations
- Immediate: Pin all image versions, remove version field
- High Priority: Add health checks, configure restart policies
- Medium: Implement multi-stage builds for optimization
Problem:
version: '3.8' # ❌ Obsolete!
services:
web:
image: nginx
Fix:
# No version field needed!
services:
web:
image: nginx:1.24-alpine
Problem:
FROM alpine
COPY app /app
CMD ["/app/server"] # Runs as root!
Fix:
FROM alpine
RUN addgroup -g 1001 appuser && \
adduser -D -u 1001 -G appuser appuser
COPY --chown=appuser:appuser app /app
USER appuser
CMD ["/app/server"]
Problem:
FROM node:18
COPY . .
RUN npm install # Includes dev dependencies!
CMD ["npm", "start"]
Fix:
# Build stage
FROM node:18 AS builder
COPY . .
RUN npm ci && npm run build
# Runtime stage
FROM node:18-alpine
COPY --from=builder /app/dist ./dist
RUN npm ci --only=production
CMD ["node", "dist/index.js"]
:latest)version field (obsolete in v2.27.0+)name: Docker Validation
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
- run: docker compose config --quiet
docker-validation:
stage: validate
image: hadolint/hadolint:latest
script:
- hadolint Dockerfile
- docker compose config --quiet
#!/bin/bash
# .git/hooks/pre-commit
if git diff --cached --name-only | grep -q "Dockerfile"; then
hadolint Dockerfile || exit 1
fi
For issues with this skill or suggestions for improvements:
Maintainer: rknall Last Updated: 2025-10-18 Skill Type: Development / DevOps
npx skills add rknall/Docker Configuration Validator下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer