Used for building apps with multiple containers. Docker compose enables you to use Docker without a Dockerfile entirely.

Basics commands

Build: docker compose build

Build without cache: docker compose build --no-cache

Building + start: docker compose up --build

Starting a single service in your docker compose configuration: docker compose up myservice

Environment variables

Docker will automatically consume envs from an .env file in the root of the project like this:

    environment:
      - NODE_ENV=${NODE_ENV}

Networks

For the default hostname of an service, the service name is used, not the container name. For more on Docker Networks see: Networks.