docker-1-image-optimization
Sub-skill of docker: 1. Image Optimization (+4).
Best use case
docker-1-image-optimization is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of docker: 1. Image Optimization (+4).
Teams using docker-1-image-optimization should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/1-image-optimization/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How docker-1-image-optimization Compares
| Feature / Agent | docker-1-image-optimization | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of docker: 1. Image Optimization (+4).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 1. Image Optimization (+4)
## 1. Image Optimization
```dockerfile
# Use specific versions
FROM python:3.12.1-slim # Not :latest
# Combine RUN commands to reduce layers
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir -r requirements.txt
# Use .dockerignore
# .dockerignore
.git
.gitignore
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.env*
*.md
.pytest_cache
__pycache__
*.pyc
.coverage
htmlcov
```
## 2. Security Best Practices
```dockerfile
# Run as non-root user
RUN useradd --create-home --shell /bin/bash appuser
USER appuser
# Don't store secrets in images
# Use environment variables or secrets management
# Scan images for vulnerabilities
# docker scan myimage:latest
# Use read-only filesystem where possible
# docker run --read-only myimage
```
## 3. Layer Caching Strategy
```dockerfile
# Order from least to most frequently changed
FROM node:20-alpine
# 1. System dependencies (rarely change)
RUN apk add --no-cache git
# 2. Package manifests (change sometimes)
COPY package*.json ./
RUN npm ci
# 3. Application code (changes often)
COPY . .
# 4. Build step
RUN npm run build
```
## 4. Health Checks
```dockerfile
# HTTP health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# TCP health check
HEALTHCHECK --interval=30s --timeout=3s \
CMD nc -z localhost 5432 || exit 1
# Custom script
HEALTHCHECK --interval=30s --timeout=10s \
CMD /app/healthcheck.sh || exit 1
```
## 5. Logging Best Practices
```yaml
services:
app:
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
labels: "service,environment"
env: "NODE_ENV"
```Related Skills
stable-diffusion-image-generation
State-of-the-art text-to-image generation with Stable Diffusion models via HuggingFace Diffusers. Use when generating images from text prompts, performing image-to-image translation, inpainting, or building custom diffusion pipelines.
skill-chain-context-optimization
Refactor large or frequently-run skills into context-efficient chains using isolated execution, file-backed handoffs, minimal summaries, and runtime-aware command substitution.
usage-optimization
Optimize AI usage efficiency through script-first patterns, batch operations, and input preparation
nextflow-pipelines-docker-issues
Sub-skill of nextflow-pipelines: Docker issues (+2).
docker-common-issues-and-solutions
Sub-skill of docker: Common Issues and Solutions (+1).
docker-6-development-workflow-scripts
Sub-skill of docker: 6. Development Workflow Scripts.
docker-4-networking-patterns
Sub-skill of docker: 4. Networking Patterns (+1).
docker-4-database-migration-pattern
Sub-skill of docker: 4. Database Migration Pattern.
docker-3-docker-compose-for-development
Sub-skill of docker: 3. Docker Compose for Development.
docker-2-multi-stage-builds
Sub-skill of docker: 2. Multi-Stage Builds.
docker-1-cicd-pipeline-integration
Sub-skill of docker: 1. CI/CD Pipeline Integration (+2).
docker-1-basic-dockerfile-patterns
Sub-skill of docker: 1. Basic Dockerfile Patterns.