ZH

YAML and Docker Compose

Every .yaml / .yml file is read as YAML.

Editing

  • Colours: keys, anchors / aliases / <<, tags (!php/const, !tagged_iterator), block scalars, ${VAR:-default}.
  • Problems as you type: syntax errors with line and column; in Compose files unknown keys, a service without image nor build, ports / volumes / environment / restart written wrong, depends_on / networks / named volumes nobody declares; Symfony's config/services.yaml keys.
  • Completion: Compose keys and values, ready-made services under services:, image: names and tags from Docker Hub, Symfony's service keys, JumPHP's config/*.yaml.
  • Hover on image:: Docker Hub's description, stars and pulls.
  • Folding, and the outline in Structure (Ctrl+F12).

Ctrl+click / F12 goes to the definition, Shift+F12 / Alt+F7 lists the usages, hover shows the definition, Shift+F6 renames. Values that lead to one file are links.

In Leads to
YAML itself alias *x → anchor &x; the hover of <<: *x shows the merged keys
Symfony config/ imports / resource → files; a class or controller: X::method → the code; @service → its definition; %parameter% → parameters:; %env(X)% → the .env lines; !tagged_iterator → the tagged services; !php/const → the constant
translations translations/*.yaml keys ↔ 'key'|trans in Twig and ->trans('key') in PHP
Compose extends, env_file, build, host paths, configs / secrets, depends_on / networks / volumes ↔ their declarations
JumPHP start_scene → the class, asset paths → files, input.yaml actions ↔ isPressed('…'), lang.yaml keys ↔ Lang::t('…'), form events → methods

From PHP or Twig, Ctrl+click on such a string opens its YAML.

Docker Compose in the Docker window

Docker > Compose: the project's compose files per folder, create the override, Add a service (templates), Check (docker compose config, errors in Problems), Apply. See Docker.