lazydocker/pkg/commands
Tim Abell 9545538106
Add docker-compose profile support
Implements the design captured in docs/adr/0001-docker-compose-profile-support.md
(jesseduffield/lazydocker#423). Profiles render as pseudo-projects in the
project panel; selecting one filters the services and containers panels to
the services that activate with that profile, and Up/Down/Restart on the
selection use docker compose --profile X invocations.

Key choices:

- Profile is a flag on Project (IsProfile bool), not a new type. Avoids a
  generic-type split across the SideListPanel and CommandObject.

- Reuse existing command templates (Up, Down, DownWithVolumes, Restart,
  AllLogs, DockerComposeConfig). NewCommandObject appends --profile X when
  a profile context is set, so no separate UpProfile/DownProfile/... family
  is needed. Adds a new Restart template (master had no project-level
  restart at all).

- Discovery via 'docker compose config --profiles' and
  'docker compose --profile X config --services', cached on DockerCommand
  for the session. Soft-fails on error (logs once, caches empty) so the UI
  degrades to "no profile rows" rather than popping an error.

- Per-profile service filtering uses the local project and the profile's
  service set (default services + profile-X services, per docker semantics).

- No new keybinding for project/profile restart in this PR; handler exists
  for follow-up discussion.

- New unit tests cover NewCommandObject --profile injection, GetProfiles
  caching, GetProfileServices caching, and the soft-fail path.

fixes: https://github.com/jesseduffield/lazydocker/issues/423

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 14:48:50 +01:00
..
ssh Appease linter 2023-10-10 17:39:09 +11:00
container.go Improve projects support 2026-03-15 14:53:48 +11:00
container_stats.go move container stats stuff into presentation layer 2022-11-09 21:21:36 +11:00
container_stats_test.go simplify CPU monitoring logic 2022-05-11 17:49:00 +10:00
docker.go Add docker-compose profile support 2026-05-19 14:48:50 +01:00
docker_host_unix.go feat(docker): Honor the host specified in current docker context (#464) 2023-10-09 17:13:22 +11:00
docker_host_windows.go feat(docker): Honor the host specified in current docker context (#464) 2023-10-09 17:13:22 +11:00
docker_test.go Add docker-compose profile support 2026-05-19 14:48:50 +01:00
docker_test_helpers_test.go Add docker-compose profile support 2026-05-19 14:48:50 +01:00
dummies.go Appease linter 2023-10-10 17:39:09 +11:00
errors.go clean some things up 2019-06-09 10:03:04 +10:00
image.go go.mod: github.com/docker/docker, docker/cli v26.1.4 2024-07-15 11:37:10 +02:00
network.go go.mod: github.com/docker/docker, docker/cli v27.0.3 2024-07-15 11:44:09 +02:00
os.go Appease linter 2023-10-10 17:39:09 +11:00
os_default_platform.go Wrap custom commands on shell 2022-12-01 19:04:29 +11:00
os_test.go Appease linter 2023-10-10 17:39:09 +11:00
os_windows.go Wrap custom commands on shell 2022-12-01 19:04:29 +11:00
project.go Add docker-compose profile support 2026-05-19 14:48:50 +01:00
service.go Improve projects support 2026-03-15 14:53:48 +11:00
volume.go go.mod: github.com/docker/docker, docker/cli v24.0.7 2024-07-15 11:04:43 +02:00