Recommended Open source
Use Docker and Docker Compose for containers
Package each service as a Docker image built from a Dockerfile, and describe the local stack in one Compose file.
Cost
Open source. Docker Engine and Compose are Apache-2.0. Docker Desktop is paid for larger companies.
How to do it
Docker reached 1.0 in 2014. Docker Engine 29.9.2 shipped on 20 October 2026 and Compose 5.6.1 on 21 October 2026. Both are open source under the Apache-2.0 licence. Docker is the most used cloud development tool in the Stack Overflow Developer Survey 2025, at 71.1%. Images follow the open OCI format, so they run on any container platform. Docker Desktop is proprietary and needs a paid plan for companies with 250 or more employees or 10 million dollars or more in yearly revenue. Docker Engine on Linux is free for everyone. Build images as the containers chapter says. Choose something else when you need containers without a root daemon. Then use Podman, which reads the same Dockerfiles.
Examples
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
Dockerfile example
FROM node:22.23-bookworm-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
USER node
CMD ["node", "server.js"]
YAML example
services:
app:
build: .
ports: ["8080:8080"]
environment:
DATABASE_URL: postgres://app@db/app
db:
image: postgres:18
How to check
docker compose up starts the whole stack from a fresh clone with no other setup step. Every Dockerfile pins its base image by version and digest.
Sources
Related rules
- Pin each base image by digest in Operations
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/docker-and-compose. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.