Skip to main content

A smart CLI wrapper for docker compose with interactive selection support.

Project description

Compose Lazy

๐Ÿš€ A smart CLI wrapper for docker compose โ€” with interactive file, profile, and service selection.

Overview

A CLI tool designed to streamline workflows for developers who frequently use docker compose.
In addition to short aliases for common commands, it features interactive selection of compose files, profiles, and services, and multi-repository workspace management.
Available on PyPI โ€” install instantly with pipx install compose-lazy or uv tool install compose-lazy.

ๆ—ฅๆœฌ่ชž็‰ˆREADMEใ‚‚ใ‚ใ‚Šใพใ™ใ€‚

Highlights

Basic Commands

Installing compose-lazy adds three commands to your PATH automatically.

Command Description
dcpu Alias for docker compose up
dcpe Alias for docker compose exec
dcp Alias for other subcommands (build, logs, stop, etc.)

Each command supports multiple options. See the List of Commands for details.

Multi-Repo Workspace

Register named groups of repositories as a workspace and operate all of them at once. Each repository path can have specific compose files assigned at registration time.

# Register a repository with specific compose files
$ 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)

# Launch all repos in a workspace with their registered compose files
$ 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 REPO.

Workspace configuration is stored in ~/.config/compose-lazy.

Interactive Selection

Running -f, -pf, or -s without arguments auto-detects compose files, profiles, and services, letting you choose interactively.

$ 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`.

$ dcp re -pf   # `re`start
โ˜‘ 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`.

$ dcp l -s   # `l`ogs
โ˜‘ 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/run, interactive selection starts automatically when no service name is given.

$ dcpe   # `e`xec
โ˜‘ Found 3 services!
    1. app
    2. db
    3. frontend
Enter your choice or 'q' to quit: 1
โ–ท Executing `docker compose exec app bash`.

๐Ÿ”ง Install compose-lazy

Quick Install

# Using pipx
pipx install compose-lazy
# OR using uv
uv tool install compose-lazy

Not familiar with Python tooling?

If you don't have pipx or uv installed yet:

Windows
python -m pip install --user pipx
python -m pipx ensurepath
# Restart terminal, then:
pipx install compose-lazy
macOS
brew install pipx
pipx ensurepath
pipx install compose-lazy
Linux (Ubuntu/Debian)
pip install pipx
pipx ensurepath
pipx install compose-lazy

Features

  • Interactive Selection: auto-detect and interactively select compose files, profiles, and services
  • Multi-Repo Workspace: run docker compose commands across multiple repositories at once with dcp ws
  • Short Aliases: dcp u, dcp b, dcp e โ€” fewer keystrokes for common commands
  • Dedicated Commands: dcpu and dcpe for frequent up/exec workflows
  • Cross-Platform: Works on Windows, macOS, and Linux

FAQ

Why use pipx or uv tool instead of pip?

Both pipx and uv tool install CLI tools in isolated environments, so compose-lazy won't conflict with other Python packages. The commands (dcp, dcpu, dcpe) are available globally without activating a virtual environment. uv tool is the faster alternative if you already use uv.

Requirements

  • Python 3.11+
  • Docker with Compose V2 (docker compose โ€” not docker-compose)
  • A docker-compose.yml (or *compose*.yml/yaml) in the current directory for interactive selection features

List of Commands

Common options (available for all commands): -s, -f FILE..., -pf PROFILE..., -p PROJECT

โš ๏ธ Note: -f, -pf, -p are passed before the subcommand in the actual docker compose syntax,
but in compose-lazy they are specified after the subcommand (e.g. dcp up -f FILE).

Bash Command Executed Docker Command
dcp - (Show help)
dcpu [SERVICE...] [-d] [-b] [-w] docker compose up [SERVICE...]
dcpe [SERVICE] docker compose exec SERVICE bash
dcpe [SERVICE] [COMMANDS...] docker compose exec SERVICE [COMMANDS...]
dcp up(u) [SERVICE...] docker compose up [SERVICE...]
dcp up(u) -d docker compose up -d
dcp up(u) -b docker compose up --build
dcp up(u) -w docker compose up --wait
dcp build(b) [SERVICE...] docker compose build [SERVICE...]
dcp exec(e) [SERVICE] docker compose exec SERVICE bash
dcp exec(e) [SERVICE] [COMMANDS...] docker compose exec SERVICE [COMMANDS...]
dcp run [SERVICE] docker compose run SERVICE bash
dcp restart(re) [SERVICE...] docker compose restart [SERVICE...]
dcp ps [SERVICE...] [-a] [-st STATUS] docker compose ps [SERVICE...] [--all] [--status ...]
dcp logs(l) [SERVICE...] [-fo] docker compose logs [SERVICE...] [-f]
dcp stop(s) [SERVICE...] docker compose stop [SERVICE...]
dcp down [-ro] docker compose down [--remove-orphans]
dcp workspace(ws) register(reg) Register a new repo to a workspace interactively
dcp workspace(ws) delete(del) Delete a repo from a workspace interactively
dcp workspace(ws) list(li) List all registered workspaces
dcp workspace(ws) up(u) docker compose up -d for each repo in a workspace
dcp workspace(ws) build(b) docker compose build for each repo in a workspace
dcp workspace(ws) restart(re) docker compose restart for each repo in a workspace
dcp workspace(ws) stop(s) docker compose stop for each repo in a workspace
dcp workspace(ws) down docker compose down for each repo in a workspace

and more... see dcp --help for the full list of supported commands and options.

License

MIT LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compose_lazy-0.8.0.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compose_lazy-0.8.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file compose_lazy-0.8.0.tar.gz.

File metadata

  • Download URL: compose_lazy-0.8.0.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for compose_lazy-0.8.0.tar.gz
Algorithm Hash digest
SHA256 b2acbbddb544e10c5468d0b0eae68b7bd742e6b37a8e982bda79c4a365914c6c
MD5 0b91da09d30d50469387025b7c06bdea
BLAKE2b-256 9cfc7eb6fb6fd1a00bbd012d1c55f0fe2163b73eca27ab8599c92870ab18d226

See more details on using hashes here.

File details

Details for the file compose_lazy-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: compose_lazy-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for compose_lazy-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 feee38a12d39b0039df2b774aafed989ea2920979abcd72eddf017185ebe0163
MD5 8448badbc0ce840e9362126ab1b5ec5a
BLAKE2b-256 dd697e960e8dac35bb30f12a2623efd6231847c17f308fb8854a41cc461565ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page