docker

Generate Dockerfile and docker-compose.yml configurations for containerized application deployments.

Updated Nov 1, 2024
One-click install
npx skills add https://github.com/mlorentedev/dotfiles --skill docker-mlorentedev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker
Source: https://github.com/mlorentedev/dotfiles/tree/main/harness/skills/docker
Command: npx skills add https://github.com/mlorentedev/dotfiles --skill docker-mlorentedev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing secure, efficient Docker configurations from scratch is error-prone: developers often ship images running as root, use unpinned base images, or forget healthchecks. This Skill produces hardened Dockerfile and docker-compose.yml files that follow container best practices by default. ## Core Features & Use Cases - Dockerfile Generation: Creates multi-stage Dockerfiles with pinned base image versions, non-root users, layer caching optimization, and mandatory HEALTHCHECK instructions. - Compose Orchestration: Generates docker-compose.yml files wiring multi-service stacks (e.g., app plus PostgreSQL) with health-based dependency ordering and named volumes. - Security Guardrails: Enforces rules like secrets via environment variables only, never baked into images, and slim/alpine/distroless base preferences. - Use Case: You are containerizing a Python web API with a Postgres database for local development. The Skill outputs a production-style multi-stage Dockerfile and a compose file where the app waits for the database healthcheck before starting. ## Quick Start Generate a Dockerfile and docker-compose.yml for my Python web application with a PostgreSQL database.

Frequently Asked Questions about docker

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

FAQPage Schema
How do I write a Dockerfile for a Python application?

Use a multi-stage build: a builder stage installs dependencies into wheels, then a slim final stage copies only the wheels and application code. Pin the base image (e.g., python:3.12-slim-bookworm), create a non-root user, and add a HEALTHCHECK instruction.

How do I set up docker-compose with an app and PostgreSQL database?

Define an app service built from your Dockerfile and a db service using postgres:16-alpine with a pg_isready healthcheck. Use depends_on with condition: service_healthy so the app starts only after the database is ready, and store data in a named volume.

Why should Docker containers not run as root?

Running as root inside a container increases the blast radius of a container breakout, since the process maps to root on the host. Create a dedicated user with useradd and switch to it via the USER instruction before the CMD.

How do I handle secrets in Docker images?

Pass secrets through environment variables at runtime, never bake them into image layers. In docker-compose, set them under the environment key so values stay out of the image history and build context.

What base image should I use for Docker containers?

Always pin a specific version and never use latest. Prefer slim, alpine, or distroless variants such as python:3.12-slim-bookworm or postgres:16-alpine to reduce image size and attack surface.