docker-compose-select
v1.1.0
Published
Interactive CLI tool to select and start/stop Docker Compose services from your docker-compose file
Maintainers
Readme
Docker Compose Select
An interactive CLI tool that helps you select and start specific Docker Compose services without typing long commands.
Features
- 🎯 Interactive Selection: Choose which services to start or stop from your docker-compose file
- ⬆️ Compose Up: Select and start specific services with options for detached mode and build
- ⬇️ Compose Down: Select and stop/remove running services
- 📦 Multi-File Support: Automatically handles
includedirectives to merge services from multiple compose files - 🔍 Auto-Discovery: Automatically finds docker-compose files in current or parent directories
- ⚡ Quick Options: Select detached mode and build options interactively
- 🎨 Beautiful CLI: Colorful output with clear feedback
Installation
Global Installation
npm install -gOr if you're developing locally:
npm linkLocal Installation
npm installUsage
Simply run the command in any directory that contains (or has a parent containing) a docker-compose.yml file:
dcsOr use the full command name:
docker-compose-selectHow It Works
- The tool searches for docker-compose files (
docker-compose.yml,docker-compose.yaml,compose.yml, orcompose.yaml) in the current directory and parent directories - It parses the compose file and recursively processes any
includedirectives to merge services from multiple compose files - You'll be prompted to choose an operation:
- Start services (compose up):
- Choose whether to run in detached mode (
-d) - Choose whether to build images before starting (
--build) - Select which services to start (multi-select with spacebar)
- Choose whether to run in detached mode (
- Stop/Remove services (compose down):
- View running services
- Select which services to stop (multi-select with spacebar)
- Choose whether to remove containers after stopping
- Start services (compose up):
- The tool executes the appropriate
docker composecommand with all compose files and your selected services
Examples
Starting Services
$ dcs
🐳 Docker Compose Select
✓ Found compose file: /path/to/docker-compose.yml
? What would you like to do? Start services (compose up)
? Run in detached mode (-d)? (Y/n) y
? Build images before starting containers (--build)? (y/N) n
? Select services to start:
◯ database
◯ redis
◯ api
◯ frontend
◯ worker
# After selecting services (e.g., database, redis, api):
Executing: docker compose up -d database redis apiStopping Services
$ dcs
🐳 Docker Compose Select
✓ Found compose file: /path/to/docker-compose.yml
? What would you like to do? Stop/Remove services (compose down)
Found 3 running service(s)
? Select services to stop:
◯ database
◯ redis
◯ api
? Remove containers after stopping? (y/N) n
# After selecting services (e.g., database, redis):
Executing: docker compose stop database redisSupported Docker Compose Files
The tool automatically detects:
docker-compose.ymldocker-compose.yamlcompose.ymlcompose.yaml
Multi-File Support
The tool supports Docker Compose include directives (Compose v2.20+), allowing you to split services across multiple files:
# docker-compose.yml
include:
- docker-compose.base.yml
- docker-compose.apps.yml
services:
cache:
image: memcached:alpineWhen using includes, the tool will:
- Recursively parse all included files
- Merge services from all files
- Show which files are being used
- Execute commands with all necessary
-fflags
Requirements
- Node.js >= 18.0.0
- Docker and Docker Compose installed on your system
License
MIT
