DCM is a command-line utility for managing multiple Docker Compose projects across different directories.
- Find all Docker Compose projects in a specified directory
- List, start, stop, and check status of projects
- Save and manage favorite Docker Compose projects with aliases
- Use managed projects without specifying paths
- Colorful output with emojis for better visualization
- Concurrent operations for faster management of multiple projects
# Install directly using Go
go install github.com/mitas/dcm/cmd/dcm@latest
# Clone the repository
git clone https://github.com/mitas/dcm.git
cd dcm
# Build using Makefile
make build
# Optional: Install to your $GOPATH/bin
make install
# Clone the repository
git clone https://github.com/mitas/dcm.git
cd dcm
# Build the application
go build -o dcm ./cmd/dcm
# Optional: Move the binary to your PATH
sudo mv dcm /usr/local/bin/
-p, --path string Root path to search for Docker Compose projects
-c, --config string Path to config file (default is ~/.config/dcm/config.yaml)
Note: When using managed projects, the --path
flag is not required.
List all Docker Compose projects in a directory:
dcm --path /path/to/projects list
Example output:
📋 Found 17 Docker Compose projects:
📁 1. project-a (/path/to/projects/project-a/docker-compose.yml)
📁 2. project-b (/path/to/projects/project-b/docker-compose.yml)
📁 3. project-c (/path/to/projects/project-c/docker-compose.yml)
📁 4. project-d (/path/to/projects/sub/project-d/docker-compose.yml)
📁 5. project-e (/path/to/projects/sub/project-e/docker-compose.yml)
...
Start a specific project:
# Using project name flag
dcm --path /path/to/projects start --project myproject
# Or using positional argument
dcm --path /path/to/projects start myproject
Example output:
🔄 Starting Docker Compose project: myproject
✅ Successfully started myproject
Start all projects:
dcm --path /path/to/projects start --all
Stop a specific project:
# Using project name flag
dcm --path /path/to/projects stop --project myproject
# Or using positional argument
dcm --path /path/to/projects stop myproject
Example output:
🔄 Stopping Docker Compose project: myproject
✅ Successfully stopped myproject
Stop all projects:
dcm --path /path/to/projects stop --all
Check status of a specific project:
# Using project name flag
dcm --path /path/to/projects status --project myproject
# Or using positional argument
dcm --path /path/to/projects status myproject
Example output:
🔄 Checking status of Docker Compose project: myproject
=== Status of myproject (/path/to/projects/myproject) ===
🟢 myproject_redis: running (Up 7 seconds)
🟢 myproject_db: running (Up 7 seconds)
🟢 myproject_api: running (Up 7 seconds)
🟢 myproject_web: running (Up 7 seconds)
Check status of all projects:
dcm --path /path/to/projects status --all
# Add a project with default alias (project name)
dcm --path /path/to/projects add-managed myproject
# Add a project with custom alias
dcm --path /path/to/projects add-managed myproject --alias prod-api
Example output:
✅ Project 'myproject' added to managed projects with alias 'prod-api'
# Using the full command
dcm list-managed
# Using aliases
dcm lsm
dcm lm
Example output:
📋 Managed Projects:
📌 1. project-a (alias) -> project-a (/path/to/projects/project-a)
📌 2. api (alias) -> myproject (/path/to/projects/myproject)
📌 3. prod-api (alias) -> myproject (/path/to/projects/myproject)
Note: Each Docker Compose file path can only be added once to managed projects.
Once projects are managed, you can start, stop, and check their status without specifying a path:
# Start a managed project
dcm start prod-api
Example output:
🔄 Starting managed Docker Compose project: prod-api
✅ Successfully started myproject
# Check status of a managed project
dcm status prod-api
Example output:
🔄 Checking status of managed Docker Compose project: prod-api
=== Status of myproject (/path/to/projects/myproject) ===
🟢 myproject_redis: running (Up 5 seconds)
🟢 myproject_db: running (Up 5 seconds)
🟢 myproject_api: running (Up 5 seconds)
🟢 myproject_web: running (Up 5 seconds)
# Stop a managed project
dcm stop prod-api
Example output:
🔄 Stopping managed Docker Compose project: prod-api
✅ Successfully stopped myproject
dcm remove-managed prod-api
Example output:
✅ Project with alias 'prod-api' removed from managed projects
First, list all projects in your development directory:
dcm --path ~/dev list
Start a specific project:
dcm --path ~/dev start myproject
Check the status:
dcm --path ~/dev status myproject
Add the project to managed projects with an alias:
dcm --path ~/dev add-managed myproject --alias api
List managed projects:
dcm list-managed
Use the managed project (no path needed):
dcm start api
dcm status api
dcm stop api
Remove from managed projects when no longer needed:
dcm remove-managed api
The project includes a Makefile with the following commands:
# Build the binary
make build
# Format, lint, and build the code
make all
# Run tests
make test
# Format the code
make fmt
# Run linter
make lint
# Build for multiple platforms (Linux, macOS, Windows)
make release
# Show all available commands
make help
The project follows a clean architecture with the following structure:
dcm/
├── cmd/
│ └── dcm/ # Application entry point
├── internal/
│ ├── cli/ # CLI interface
│ ├── cmd/ # Command implementations
│ ├── config/ # Configuration handling
│ ├── manager/ # Business logic
│ └── model/ # Data structures
└── pkg/
└── formatter/ # Output formatting
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.