Pin image versions instead of using latest, run as a non-root user, add health checks and restart policies, keep secrets out of images, and update base images regularly.
services: app: image: myapp:1.4.2 restart: unless-stopped healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"] interval: 30s retries: 3 env_file: .env # keep .env out of git