If you work with Docker Compose daily, you've typed some version of this hundreds of times:
docker compose -f docker-compose.prod.yml --profile dev exec app bash
compose-lazy is a CLI tool I built to cut that down. It provides shorthand commands for the most common docker compose workflows, and — more usefully — lets you pick compose files, profiles, and services interactively instead of remembering or typing them.
pipx install compose-lazy
# or
uv tool install compose-lazy
Three commands are added to your PATH: dcp, dcpu, and dcpe.
The basics: shorter commands
# docker compose up --build -d
dcpu -b -d
# docker compose exec app bash
dcpe app
# docker compose logs app -f
dcp l app -fo
# docker compose stop
dcp s
The aliases map closely to the originals — dcpu is always docker compose up, dcpe is always docker compose exec, and dcp is a general-purpose entry point for everything else (build, restart, ps, logs, stop, down, ...).
The useful part: interactive selection
This is where compose-lazy earns its name. Pass an option flag without a value and it reads your project and prompts you to choose.
Pick a compose file with -f
$ dcpu -f
☑ Found 2 compose files!
1. docker-compose.yml
2. docker-compose.prod.yml
Enter your choices (e.g., 1,3,4) or 'q' to quit: 2
▷ Executing `docker compose -f docker-compose.prod.yml up`.
Multiple selections work too — enter 1,2 to use both files.
Pick a profile with -pf
$ dcp re -pf
☑ Found 2 profiles!
1. dev
2. prod
Enter your choices (e.g., 1,3,4) or 'q' to quit: 1
▷ Executing `docker compose --profile dev restart`.
Pick a service with -s
$ dcp l -s
☑ Found 3 services!
1. app
2. db
3. frontend
Enter your choices (e.g., 1,3,4) or 'q' to quit: 1,2
▷ Executing `docker compose logs app db`.
For exec and run, the service prompt appears automatically when no service is given — no -s needed:
$ dcpe
☑ Found 3 services!
1. app
2. db
3. frontend
Enter your choice or 'q' to quit: 1
▷ Executing `docker compose exec app bash`.
There's also a small quality-of-life detail: dcpe uv run pytest auto-detects that uv isn't a service name, falls back to interactive service selection, and carries uv run pytest forward as the inner command.
Workspace management: operate multiple repos at once
The workspace feature is for projects that span multiple repositories. Register repos into a named workspace and run commands across all of them with a single prompt.
Register a repo
$ dcp ws register
Please enter a new directory path: /path/to/repo
☑ Found 2 docker-compose files!
1. docker-compose.yml
2. docker-compose.prod.yml
Enter your choices (e.g., 1,3,4) or 'q' to quit: 1
☑ Found 1 registered workspace!
1. myproject
Or '0' for a new entry.
Enter your choice or 'q' to quit: 0
Please enter a new workspace name: myproject
☑ Registered new path to myproject: /path/to/repo (docker-compose.yml)
You can register multiple repos into the same workspace. Each repo gets its own compose file pinned at registration time.
Bring up everything
$ dcp ws up
☑ Found 1 registered workspace!
1. myproject
Enter your choice or 'q' to quit: 1
───── 📂 myproject ──────────────────────────────────────────────────────────
▷ Executing `docker compose -f docker-compose.yml up -d` in MYPROJECT.
All workspace subcommands:
| Command | What it runs |
|---|---|
dcp ws register(reg) |
Register a repo interactively |
dcp ws delete(del) |
Remove a repo |
dcp ws list(li) |
Show all workspaces and their repos |
dcp ws up(u) |
docker compose up -d across all repos |
dcp ws build(b) |
docker compose build across all repos |
dcp ws restart(re) |
docker compose restart across all repos |
dcp ws stop(s) |
docker compose stop across all repos |
dcp ws down |
docker compose down across all repos |
Config lives in ~/.config/compose-lazy/config.yml.
Requirements
- Python 3.11+
- Docker with Compose V2 (
docker compose, notdocker-compose)
Top comments (0)