← Knowledge Base
DockerReference note1 min read · updated 2026-11-27

Docker Compose: a service file and the daily commands

A small compose file with volumes, a restart policy and a health check, and the commands to run it.

dockercomposeyaml
services:
  app:
    image: myorg/app:1.4
    restart: unless-stopped
    ports: ["127.0.0.1:8080:8080"]
    environment:
      - LOG_LEVEL=info
    volumes:
      - appdata:/data
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:8080/health"]
      interval: 30s
      timeout: 5s
      retries: 3
volumes:
  appdata:
docker compose up -d               # create/update and start
docker compose ps
docker compose logs -f app
docker compose pull && docker compose up -d     # update images
docker compose down                # stop and remove containers (keeps named volumes)
docker compose down -v             # ...and the volumes: deletes data!
docker compose config              # validate and print the merged file

Pin image versions rather than latest. Publishing on 127.0.0.1: keeps a port private to the host (put a reverse proxy in front).