docker-containerization

Build multi-stage Dockerfiles and Docker Compose configurations for Python and Node.js applications.

Updated May 16, 2026
One-click install
npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill docker-containerization-organvm-i-theoria
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docker-containerization
Source: https://github.com/organvm-i-theoria/_agent-ontology/tree/main/.agents/skills/docker-containerization
Command: npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill docker-containerization-organvm-i-theoria

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Containerizing applications involves many decisions—base images, layer ordering, security hardening, and multi-service orchestration—and getting them wrong leads to bloated images, slow builds, and insecure containers. This Skill provides proven patterns for writing efficient Dockerfiles and Compose files without trial and error. ## Core Features & Use Cases - Multi-Stage Builds: Ready-to-adapt Dockerfile templates for Python and Node.js that separate build and runtime stages to minimize image size. - Docker Compose Orchestration: Multi-service configurations with health checks, dependency ordering, development overrides, and volume management. - Security Hardening: Non-root user setup, read-only filesystems, secrets management, and vulnerability scanning with docker scout and trivy. - Use Case: You have a FastAPI service backed by PostgreSQL and Redis. Use this Skill to generate a slim multi-stage Dockerfile, a Compose file with health-checked dependencies, and a development override with hot reload. ## Quick Start Containerize my Python FastAPI application with a multi-stage Dockerfile and a Docker Compose setup including PostgreSQL and Redis.

Frequently Asked Questions about docker-containerization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a multi-stage Dockerfile for a Python application?▼

Use a builder stage to install dependencies with pip into a prefix directory, then copy only the installed packages into a slim runtime stage. This keeps build tools out of the final image and typically reduces size by 40-70%.

How do I reduce Docker image size?▼

Combine alpine or slim base images (50-80% savings), multi-stage builds (40-70%), pip's --no-cache-dir flag (10-20%), and a .dockerignore excluding .git, node_modules, and tests. Order layers from least to most frequently changing to maximize cache hits.

How do I make Docker Compose wait for a database to be ready?▼

Define a healthcheck on the database service (e.g., pg_isready for PostgreSQL) and use depends_on with condition: service_healthy on the dependent service. Alternatively, use a wait-for-it entrypoint script that polls until the database accepts connections.

How do I run a Docker container as a non-root user?▼

Create a dedicated user and group in the Dockerfile with addgroup and adduser, then switch with the USER instruction before the CMD. Node.js official images already include a node user you can use directly.

How do I handle secrets in Docker Compose without putting them in the image?▼

Use the Compose secrets top-level element to mount secret files at /run/secrets inside the container, and point your app at the file path via an environment variable like DB_PASSWORD_FILE. Never bake secrets into image layers.

Why is using the latest tag in production a bad practice?▼

The latest tag is mutable, so builds become non-reproducible and unexpected upstream changes can break deployments. Pin specific versions like postgres:16-alpine or python:3.12-slim to keep environments consistent.