If you work with Docker Compose regularly, you probably know the struggle: switching directories constantly, remembering where projects are located, running the same docker compose commands repeatedly, and maintaining awkward shell scripts to keep things organized.
Captain is a modern, actively maintained command line tool that automatically discovers all your Docker Compose projects and allows you to manage them from anywhere on your system. No directory changes, no scripts, no friction.
This article explains why Captain exists, what motivated the project, and why developers find it so useful.
Why create a new tool?
It is fair to ask: Why build yet another tool for managing Docker? The answer is simple: because the existing ones were no longer maintained or did not meet the needs of modern Docker development.
The original “captain” was abandoned
Years ago, the developer jenssegers released a great little tool called captain. It allowed users to manage Docker Compose projects quickly. But the project stopped being updated, and over time it became outdated:
- No support for modern “docker compose” (Compose V2)
- Outdated Go code and structure
- No support for multiple root directories
- Limited .env file handling
- Issues left unresolved
- Behavior inconsistent with today’s workflows
The idea was excellent, but the tool simply didn’t evolve as Docker itself evolved.
No modern alternative existed
Before creating this fork, several options were evaluated:
- Docker desktop GUIs (too heavy)
- DevOps platforms (too complex for local dev)
- Shell scripts (fragile and hard to maintain)
- Other community tools (mostly unmaintained)
There was no simple, actively maintained, lightweight CLI that could:
- Automatically discover Compose projects
- Support Compose V1 and V2
- Allow fuzzy matching of project names
- Load extra .env files
- Stay out of the user’s way
Captain fills this gap.
What Captain does
Captain scans your directory roots for Docker Compose files and treats every folder containing one as a project. It supports:
- docker-compose.yml
- docker-compose.yaml
- compose.yml
- compose.yaml
Once detected, the project can be controlled with a single command.
Examples:
captain up backend
captain down postgres
captain logs api
captain exec postgres psql -U admin
captain run redis redis-cli
You can run these commands from any directory.
Fuzzy matching
Don’t remember the exact project name?
captain up mail
This could match:
- mail-service
- mailserver
- email-service
Captain automatically selects the closest match.
Multiple root directories
You can tell Captain to search several root directories:
export CAPTAIN_ROOTS="$HOME/dev:$HOME/docker:$HOME/services"
Captain merges all discoveries into a single list.
Extended .env support
Docker Compose normally loads only the default .env file. Captain extends this by allowing extra environment files:
Global:
export CAPTAIN_ENV_FILES=".env.common:.env.secrets"
Per command:
captain up shop --env-file .env.production
Modern Go codebase
The fork introduces a cleaned project structure:
- cmd/ for entry point
- internal/config
- internal/projects
- internal/compose
This makes the tool far easier to maintain and extend.
Zero runtime overhead
Captain is not a daemon and does not run in the background. It executes only when you call it.
Captain in action
List all discovered projects:
captain ls
Start a project:
captain up blog
Stop it:
captain down blog
View logs:
captain logs backend
Run a one-off command:
captain run redis redis-cli
Installation
Install via Go:
go install github.com/tkaefer/captain/cmd/captain@latest
Build from source:
git clone https://github.com/tkaefer/captain
cd captain
make
sudo mv captain /usr/local/bin
Who Captain is for
Captain is ideal for developers who:
- run multiple local Docker Compose projects
- work with microservices
- maintain large codebases or monorepos
- want a faster, cleaner Docker workflow
Why you should try Captain
Captain revives a great idea, updates it for modern Docker, and adds practical features that solve real everyday problems. It is lightweight, actively maintained, simple to use, and instantly useful.
Get started
GitHub:
https://github.com/tkaefer/captain
Install now:
go install github.com/tkaefer/captain/cmd/captain@latest
