services: The top-level map in a Compose file. Each entry is one container definition — image or build, ports, env, volumes. services is the top-level section of a Docker Compose file. Each entry defines one container: which image to use or build, which ports to publish, environment variables, volumes and dependencies.
A typical web project has services like app, web, mysql and redis. Compose starts them together, puts them on a shared network and lets them reach each other by service name.
What should you keep in mind with services?
Keep each service focused on one process. Use named volumes for databases so data survives restarts, health checks so dependent services wait properly, and an .env file for settings that differ per developer. A Compose file that gets a new developer running with one docker compose up command is one of the most valuable files in a project.
Use this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a database or cache dependency, or running services without host-level installs. Covers Dockerfile, compose.yaml, and .dockerignore creation with Docker best practices.
Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.
Use this skill when writing, reviewing, or optimizing Dockerfiles, even if the user just says their image is too large, their build is slow, or they need to harden a container for production. Covers multi-stage builds, layer caching, .dockerignore, non-root users, and image size optimization.