Repository navigation
05 Container Backends
If your project uses Docker Compose, croft works out of the box —
detect services, exec into them, run compose ps / logs /
build through croft. If you use plain Docker, Podman, or no
containers at all, flip one setting in croft.toml and keep
going. The recipe surface (in = "<service>", lifecycle keymaps,
etc.) doesn't change.
For a typical compose project, you don't need any config — croft picks Compose by default and auto-discovers your services.
croft ps # → docker compose ps
croft logs app # → docker compose logs app
croft app php -v # → docker compose exec app php -vRouting a recipe into a service is one line:
[command.test]
in = "app"
run = "composer test"croft test runs composer test inside the app service after
a status preflight.
-
Pick a backend.
[runtime].backendis one ofcompose(default),docker,podman, ornone. Everything below this layer talks through the sameBackendtrait, so recipe semantics are identical regardless. -
Route per recipe.
in = "<service>"says "exec this inside that container service." Without it, the recipe runs on the host (or inside the devcontainer if that's enabled — see Devcontainer). -
Passthrough fills the gaps. If you type
croft <name>and the name isn't a recipe / script, croft tries it as a compose subcommand (docker compose <name>) and then as a service exec shortcut (docker compose exec <name>). Both are on by default; either can be turned off when they collide with recipe names.
[command.shell]
in = "app"
run = "/bin/sh"
tty = true
[command.test]
in = "app"
run = "composer test"tty = true allocates a TTY (-it) — required for interactive
shells, irrelevant for pure-stdout commands.
[runtime]
default_service = "app"
[command.artisan]
run = "php artisan"
forward_args = true
# no `in =` — uses default_service = "app"Recipes without explicit in = fall back to default_service.
Service passthrough lets you skip writing a recipe for one-offs:
croft app php -v # → docker compose exec app php -v
croft db psql -U pg # → docker compose exec db psql -U pg[runtime]
backend = "podman" # or "docker"Same recipe surface, different CLI underneath. Podman's compose
compatibility layer handles the same [command.*] in = routing.
[runtime]
backend = "none"Compose preflight is skipped. Useful when [[services.custom]]
or [[services.systemd]] covers your stack — croft still manages
their lifecycle and shows them in the TUI. See
Non-Container Services.
If you have a recipe called up and don't want croft up to fall
through to docker compose up:
[runtime]
compose_passthrough = falseSame for service-name shortcuts:
[runtime]
service_passthrough = falsecroft doctorReports the active backend, whether its CLI is on PATH, and
whether each declared default_service exists in the compose
project.
| Backend | Notes |
|---|---|
compose |
Default. docker compose (v2). Service discovery via docker compose config --services. |
docker |
Plain docker for run / exec. |
podman |
Podman compatibility layer. |
none |
Skip container preflight entirely; useful when only [[services.custom]] / [[services.systemd]] apply. |
[runtime]
backend = "compose"
default_service = "app"
compose_passthrough = true
service_passthrough = true-
default_service— recipes withoutin =use this. -
compose_passthrough— when on,croft <name>falls through todocker compose <name>for unknown names. Setfalseto make recipe names absolute. -
service_passthrough— when on,croft <name>falls through todocker compose exec <name>if<name>matches a compose service. Setfalseto make service names absolute.
The TUI sidebar auto-discovers every compose service and shows
them with the standard lifecycle keymap (r start, R restart,
s stop, S stop & remove, U up, D down). The same keymap
applies to [[services.custom]] and [[services.systemd]]
declarations, so the user experience is uniform across backends.
See TUI.
- Non-Container Services for system daemons you want to manage alongside compose.
-
Recipes and Scripts for the full
resolution order and
in = "..."semantics. - Devcontainer for routing host-targeted recipes into a devcontainer workspace.
croft is dual-licensed under MIT or Apache 2.0. Source: github.com/nsrosenqvist/croft. Back to Home.