Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
pluginagentmarketplace avatar

Docker Optimization

  • 70 installs
  • 2 repo stars
  • Updated January 5, 2026
  • pluginagentmarketplace/custom-plugin-docker

docker-optimization is an agent skill that guides Docker image size, build speed, and runtime tuning for solo-builder deploys.

About

docker-optimization is a containers-focused agent skill that encodes opinionated defaults and checklists for smaller images, faster CI builds, and steadier runtime behavior. Indie SaaS and API builders invoke it when Dockerfile drift has bloated images, layer caches miss constantly, or production containers lack sensible memory caps and health probes. The skill ships structured YAML-style settings (enabled flags, log levels, dev versus production strict validation) plus categorized guidance across image_size, build_speed, and runtime_performance—suitable for agents that emit markdown recommendations or plugin configuration. It is not a full security hardening or Kubernetes manifest generator; it complements those steps by making the container layer cheap to build and reliable to run. Use during late Build when first containerizing, during Ship when tightening CI, and during Operate when revisiting limits after incidents. Pair with your registry and orchestrator docs so limits match your host.

  • Image size playbook: alpine/slim bases, multi-stage builds, cache cleanup, combined RUN layers, and .dockerignore
  • Build speed: layer ordering by change frequency, BuildKit cache, parallel builds, and build-arg discipline
  • Runtime performance: memory limits, CPU shares, tmpfs for temp I/O, health checks, and restart policies
  • Markdown-oriented output format with optional strict validation in production environments
  • Integrations toggles for git, linter, and formatter in generated plugin-style config

Docker Optimization by the numbers

  • 70 all-time installs (skills.sh)
  • +1 installs in the week ending Jul 26, 2026 (Skillselion tracking)
  • Ranked #620 of 1,453 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 26, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-docker --skill docker-optimization

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs70
repo stars2
Security audit3 / 3 scanners passed
Last updatedJanuary 5, 2026
Repositorypluginagentmarketplace/custom-plugin-docker

What it does

Shrink Docker images, speed up builds, and tune container runtime limits before you ship services to production.

Who is it for?

Best when you're shipping containerized APIs or workers and want fast, repeatable image builds without hiring a platform team.

Skip if: Bare-metal deploys with no Docker, or teams needing full SOC2 container compliance narratives in one skill.

When should I use this skill?

User asks to optimize Docker images, speed up container builds, or improve runtime performance of Dockerized services.

What you get

You get a structured optimization checklist and config defaults—multi-stage patterns, BuildKit habits, and runtime policies—ready to paste into Dockerfiles and compose files.

  • Markdown optimization report with categorized recommendations
  • Optional docker-optimization YAML-style configuration for plugin workflows

By the numbers

  • Three optimization pillars: image_size, build_speed, runtime_performance
  • Environment profiles: development and production with distinct log_level and strict_mode validation

Files

SKILL.mdMarkdownGitHub ↗

Docker Optimization Skill

Comprehensive optimization techniques for Docker images and containers covering size reduction, build caching, and runtime performance.

Purpose

Reduce image size, improve build times, and optimize container performance using 2024-2025 industry best practices.

Parameters

ParameterTypeRequiredDefaultDescription
targetenumNoallsize/build/runtime/all
base_imagestringNo-Current base image
current_sizestringNo-Current image size

Optimization Strategies

1. Image Size Reduction

Base Image Selection
BaseSizeUse Case
scratch0Static Go/Rust binaries
distroless2-20MBProduction containers
alpine5MBGeneral purpose
slim80-150MBWhen apt packages needed
full500MB+Development only
# Before: 1.2GB
FROM node:20

# After: 150MB (88% smaller)
FROM node:20-alpine
Layer Optimization
# Bad: 3 layers, 150MB
RUN apt-get update
RUN apt-get install -y curl
RUN rm -rf /var/lib/apt/lists/*

# Good: 1 layer, 50MB
RUN apt-get update && \
    apt-get install -y --no-install-recommends curl && \
    rm -rf /var/lib/apt/lists/*
Remove Unnecessary Files
# Clean package manager cache
RUN npm cache clean --force
RUN pip cache purge
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Use .dockerignore
# node_modules, .git, *.md, tests/, docs/

2. Build Speed Optimization

Layer Caching Strategy
# Dependencies first (rarely change)
COPY package*.json ./
RUN npm ci

# Source code last (frequently changes)
COPY . .
RUN npm run build
BuildKit Cache Mounts
# syntax=docker/dockerfile:1
FROM node:20-alpine

# Cache npm packages
RUN --mount=type=cache,target=/root/.npm \
    npm ci

# Cache pip packages
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install -r requirements.txt
Parallel Multi-Stage
# Parallel stages (BuildKit)
FROM node:20-alpine AS deps
COPY package*.json ./
RUN npm ci

FROM deps AS builder
COPY . .
RUN npm run build

FROM deps AS linter
COPY . .
RUN npm run lint

3. Runtime Performance

Resource Limits
services:
  app:
    deploy:
      resources:
        limits:
          cpus: '1'
          memory: 512M
        reservations:
          cpus: '0.5'
          memory: 256M
Container Tuning
# Set memory limits
docker run --memory=512m --memory-swap=512m app

# CPU limits
docker run --cpus=1.5 app

# I/O limits
docker run --device-read-bps=/dev/sda:1mb app

Optimization Checklist

Size Checklist

  • [ ] Using smallest viable base image?
  • [ ] Multi-stage build implemented?
  • [ ] Package manager cache cleaned?
  • [ ] Dev dependencies excluded?
  • [ ] .dockerignore configured?

Build Speed Checklist

  • [ ] Dependencies copied before code?
  • [ ] BuildKit enabled?
  • [ ] Cache mounts used?
  • [ ] Parallel stages where possible?

Runtime Checklist

  • [ ] Resource limits set?
  • [ ] Health checks configured?
  • [ ] Non-root user?
  • [ ] Read-only filesystem where possible?

Analysis Tools

# Image size analysis
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"

# Layer analysis
docker history <image> --format "{{.Size}}\t{{.CreatedBy}}"

# Deep dive analysis
dive <image>

# Build time analysis
DOCKER_BUILDKIT=1 docker build --progress=plain .

Error Handling

Common Issues

IssueCauseSolution
Large imageNo multi-stageImplement multi-stage
Slow buildsPoor layer orderDependencies before code
Cache not workingContext changesUse .dockerignore
OOM at runtimeNo limitsSet memory limits

Troubleshooting

Debug Checklist

  • [ ] BuildKit enabled? (DOCKER_BUILDKIT=1)
  • [ ] Cache being used? (Check build output)
  • [ ] .dockerignore working? (Check context size)
  • [ ] Layers optimized? (Run dive)

Usage

Skill("docker-optimization")

Related Skills

  • docker-multi-stage
  • dockerfile-basics
  • docker-production

Related skills

How it compares

Structured optimization checklist for Dockerfiles and runtime flags—not a substitute for full Kubernetes or cloud-specific landing-zone skills.

FAQ

Who is docker-optimization for?

Developers containerizing SaaS, APIs, or CLIs who want their agent to apply proven Docker size and CI cache patterns instead of one-off chat advice.

When should I use docker-optimization?

While Build backend work defines the first Dockerfile, during Ship launch prep before registry push, and in Operate infra when tuning memory and health checks after traffic grows.

Is docker-optimization safe to install?

It recommends standard Docker practices; confirm changes in staging and read the Security Audits panel on this Prism page before enabling auto-fix style options in production.

DevOps & CI/CDdeployinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.