docker-best-practices-sh-ku3ybs
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "docker-best-practices-sh-ku3ybs" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c0e4a70a4a41f8c22a1d3010e8bd7326c343787654af9d1d20a30d16d0d2086b. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/docker-best-practices-sh-ku3ybs before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A Docker best practices skillset to help an AI agent efficiently perform tasks related to Docker.
Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference
SkillPi interpretation
- Tasks
- FROM node:22-alpine AS build WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci COPY . . RUN npm run build
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: Dockerbestpractices
slug: docker-best-practices
version: 1.0.0
displayName: Dockerbestpractices
description: >
Dockerbestpractices专用技能,帮助AI Agent高效完成相关任务。
Dockerbestpractices专用技能,帮助AI Agent高效完成相关任务。
summary: "Dockerbestpractices专用技能,帮助AI Agent高效完成相关任务。"
license: MIT
category: 开发者工具
framework:
- Claude Code
- Codex
- Hermes Agent
- OpenClaw
- QClaw
- WorkBuddy
platform: multi-platform
homepage: "https://github.com/1991513ccie-png"
repository: "https://github.com/1991513ccie-png"Docker Best Practices
Multi-Stage Build
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --only=production
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine AS runtime
WORKDIR /app
RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001 -G appgroup
COPY --from=deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/package.json ./
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/healthz || exit 1
CMD ["node", "dist/server.js"]
Separate dependency installation from build steps. Final stage contains only runtime artifacts.
Python Multi-Stage
FROM python:3.12-slim AS builder
WORKDIR /app
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
FROM python:3.12-slim
WORKDIR /app
RUN useradd --create-home appuser
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY . .
USER appuser
CMD ["gunicorn", "app:create_app()", "-b", "0.0.0.0:8000", "-w", "4"]
Docker Compose
services:
api:
build:
context: .
dockerfile: Dockerfile
target: runtime
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgres://user:pass@db:5432/app
- REDIS_URL=redis://cache:6379
depends_on:
db:
condition: service_healthy
cache:
condition: service_started
restart: unless-stopped
deploy:
resources:
limits:
memory: 512M
db:
image: postgres:16-alpine
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_DB: app
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user -d app"]
interval: 5s
timeout: 3s
retries: 5
cache:
image: redis:7-alpine
command: redis-server --maxmemory 128mb --maxmemory-policy allkeys-lru
volumes:
pgdata:
.dockerignore
node_modules
.git
.env*
*.md
docker-compose*.yml
.github
coverage
dist
Always include a .dockerignore to reduce build context size and prevent leaking secrets.
Image Optimization Tips
# Check image size breakdown
docker history --human --no-trunc <image>
# Use dive for layer analysis
dive <image>
# Multi-arch build
docker buildx build --platform linux/amd64,linux/arm64 -t registry/app:1.0 --push .
Combine RUN commands to reduce layers. Order instructions from least to most frequently changing for cache efficiency.
Anti-Patterns
- Running as root inside containers
- Using
ADDwhenCOPYsuffices (ADD auto-extracts tarballs, pulls URLs) - Storing secrets in environment variables in Dockerfiles
- Not pinning base image versions (
FROM node:latest) - Missing
.dockerignorecausing large build contexts - Installing dev dependencies in production images
Checklist
- [ ] Multi-stage build separates build and runtime stages
- [ ] Non-root user created and used with
USERdirective - [ ] Base images pinned to specific versions (e.g.,
node:22-alpine) - [ ]
.dockerignoreexcludes.git,node_modules,.env - [ ]
HEALTHCHECKinstruction defined - [ ] Production image contains no build tools or dev dependencies
- [ ]
docker-composeusesdepends_onwith health conditions - [ ] Secrets passed via build secrets or runtime mounts, not
ENVin Dockerfile
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 Docker 最佳实践指南,涵盖多阶段构建、Compose 配置、镜像优化等核心内容
- 包含实用的反模式清单和检查清单,对开发者有直接指导价值
Areas to improve
-
description内容截断 Reported severity: Major
description 字段内容重复且无实际触发词描述,无法指导 Skill 何时被触发
Recommendation: 在 description 中添加明确的触发条件,如'当用户询问 Docker 最佳实践、镜像优化、Dockerfile 编写等问题时触发'
Areas to improve
-
缺少When to Use章节 Reported severity: Minor
文档缺少明确的适用场景说明章节
Recommendation: 添加 When to Use 章节说明本 Skill 的适用场景和使用时机
-
缺少执行流程说明 Reported severity: Minor
虽然有内容章节但缺少明确的 Phase/步骤流程说明和出口条件
Recommendation: 添加执行流程说明,明确用户如何与本 Skill 交互
Highlights
- 文档结构清晰,分章节介绍不同主题
- 提供完整的代码示例和配置模板
Areas to improve
-
异常处理覆盖不足 Reported severity: Minor
未覆盖构建失败、配置错误等异常场景的处理建议
Recommendation: 添加常见错误排查和处理建议章节
Highlights
- 提供的 Dockerfile 和 docker-compose 配置语法正确且符合最佳实践
- 工具来源明确,使用标准 Docker 语法和官方镜像
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 65
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
- localhost
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.