The configuration files in detail

How Dockerfile, docker-compose.yml, docker-compose.override.yml and composer.json work together, explained section by section.

How they work together

Four files describe the entire appliance. Each has a clearly defined job:

FileQuestion it answersTakes effect at
composer.jsonWhich PHP packages (TYPO3, extensions) are included?build
DockerfileHow are the images for PHP and nginx built?build
docker-compose.ymlWhich containers run, with which data, variables and dependencies?start and operation
docker-compose.override.ymlWhat is different on this machine?start and operation

What happens on docker compose up -d --build:

  1. Compose reads docker-compose.yml, merges docker-compose.override.yml into it and fills in the values from .env.
  2. For services with build, Docker builds the Dockerfile: stage app installs PHP, system packages and, via Composer, all packages according to composer.lock. Stage web copies the finished files into an nginx image.
  3. Compose starts db and elasticsearch. As soon as the database is healthy, php starts. Its entrypoint installs TYPO3 the first time, and otherwise updates the database schema, flushes the caches and syncs the search index.
  4. Once php is healthy, web and scheduler start.

This leads to the most important rule: code lives in the image, data lives in volumes. Changes to composer.json, the Dockerfile, packages/ or config/ require a rebuild. Content, uploads and backend settings survive it.