<<Home>>
dctl is a feature-rich CLI tool, written in Rust, that makes managing multiple Docker Compose projects effortless. It allows you to control all your local development stacks from anywhere in your terminal, with a consistent and simple interface.
- Centralized management: Register all your compose projects in a single config file.
- No more aliases: Use the same commands for all your projects, no matter where you are.
- Override and customize: Easily override compose files and set default arguments per command or project.
- Download the latest binary from the releases page
- Or build from source:
cd cli && cargo build --releaseRequires Rust and Cargo.
dctl uses a TOML config file, typically located at ~/.config/dctl/config.toml.
Example:
[main]
docker_bin = "/usr/bin/docker"
default_command_args = [
{ command_name = "up", command_args = ["-d", "--remove-orphans"] }
]
[[collections]]
alias = "stack_web"
description = "Web stack components"
use_project_name = true # Optional, default: true
enviroment_file = "/path/to/.env"
compose_files = [
"/path/to/web/docker-compose.yml"
]
# ... more collections ...- alias: Unique name for your project.
- use_project_name: (Optional) If true, uses the alias as the Docker Compose project name.
- description: (Optional) Free text description.
- enviroment_file: (Optional) Path to your .env file.
- compose_files: List of compose files for the project.
- default_command_args: (Optional) Default arguments per Docker Compose command.
dctl check-configValidates your config file and all referenced compose files.
dctl infosShows all registered projects and their running status (running, stopped, or partially running).
dctl cd <alias>Returns the path to the first compose file for the given project. Combine with cd in your shell:
cd "$(dctl cd <alias>)"Add a helper function to your .zshrc or .bashrc:
function gocd() {
cd "$(dctl cd $1)"
}Generate completion scripts for Bash, Zsh, Fish, etc.:
dctl completion <shell> > /path/to/completion/fileExample for Zsh:
dctl completion zsh > /usr/local/share/zsh/site-functions/_dctl
compinitdctl supports all major Docker Compose commands, including:
- up, down, start, stop, restart, build, exec, logs, ps, images, pull, push, rm, run, ls, pause, unpause, kill, create, events, top
Arguments and options are passed through to Docker Compose, so you can use dctl just like the original tool.
Contributions are welcome! Open an issue or a pull request to help improve dctl.