STK-53Default 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.
Review by
2027-04-30
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 2026, at 59.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 Pin each base image by digest says. Choose something else when you need containers without a root daemon. Then use Podman, which reads the same Dockerfiles.
Examples
Dockerfile example
FROM node:24.22-trixie-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
- ENG-67 Run the same images locally with Compose in Engineering
- ENG-68 Pin each base image by digest in Engineering
- STK-100 Avoid Kubernetes until Compose and a managed container service fall short in Software choices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/docker-and-compose">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.