惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
D
DataBreaches.Net
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
人人都是产品经理
人人都是产品经理
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
腾讯CDC
博客园_首页
The Cloudflare Blog
S
SegmentFault 最新的问题
C
Check Point Blog
美团技术团队
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Stop Typing Long Docker Compose Commands — compose-lazy D...
HiroItozzz · 2026-06-03 · via DEV Community

HiroItozzz

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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)

Enter fullscreen mode Exit fullscreen mode

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.

Enter fullscreen mode Exit fullscreen mode

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, not docker-compose)

🔗 PyPI | GitHub