⚓ docker-captain
docker-captain is a friendly command-line tool that helps you manage multiple Docker Compose projects under a single folder.
🚀 Features
For a quick overview of the available commands, run docker-captain --help.
🔍 Project Auto-Detection
docker-captain automatically detects any subfolder containing a Docker Compose file — such as compose.yaml, compose.yml, docker-compose.yaml, or docker-compose.yml.
It scans the folder specified in the configuration file, or passed in the DOCKER_CAPTAIN_PROJECTS environment variable, which you can export here:
export DOCKER_CAPTAIN_PROJECTS=/path/to/your/deployments # takes precedence over the config file
Detection is purely based on the file names — if a folder contains one of those Compose files, it’s recognized as a valid “project”, taking its name from the folder.
⚙️ Project Management via manage
Use the docker-captain manage command to interactively select which projects should be considered active.
You’ll see a multi-select list of all detected projects — you can check or uncheck them using the keyboard, then confirm with Enter.
The selected projects become your active fleet, used by commands like rally and abandon.
🚢 Easy Interaction with Single Projects
Need to start or stop one project? Use these straightforward commands:
docker-captain start calibre --detach --remove-orphans
docker-captain stop calibre --remove-orphans
docker-captain restart calibre
They’re thin wrappers around standard docker compose commands (up, down, and restart), but automatically use the correct compose file and folder context.
Flags:
-d/--detach: Run containers in background.--remove-orphans: Remove orphaned containers not defined in the compose file.
📋 Listing Projects with list
See all detected projects neatly formatted in a Rich table:
docker-captain list
This shows:
- Project name
- Whether it’s Active (selected via
manage) - Whether it’s currently Running (
docker compose lsis checked behind the scenes)
You can also view the compose file paths with --verbose:
docker-captain list --verbose
⚓ Rally and Abandon Your Fleet
Once you’ve marked projects as active using manage, you can control them all together:
-
Start all active projects:
docker-captain rally --detach
-
Stop all active projects:
docker-captain abandon
These commands behave like start and stop, but apply to every active project in one go — perfect for booting up or shutting down your entire environment.
📦 Installation
You can install docker-captain using uv, pipx, or plain pip.
# Install with
uv tool install docker-captain
pipx install docker-captain
# or try it out with
uvx docker-captain
🗒️ Configuration
captain-docker support a simple YAML config file with the following structure:
# ~/.config/docker-captain/config.yaml (on Linux)
projects_folder: /path/to/your/deployments # environment variable: DOCKER_CAPTAIN_PROJECTS_FOLDER
This configuration file can be generated interactively by running captain-docker configure.
🧭 Folder Structure Example
Your deployments might look like this:
~/Deployments/
├── calibre/
│ └── compose.yaml
├── immich/
│ ├── compose.yaml
│ └── immich.env
├── paperless-ngx/
│ ├── compose.yaml
│ └── paperless-ngx.env
└── syncthing/
└── compose.yaml
Each subfolder is automatically detected as a project if it has a Compose file.
🧠 Tech Stack
| Library | Purpose |
|---|---|
| Typer | CLI framework |
| Rich | Beautiful terminal output |
| Questionary | Interactive prompts |
| sh | Simple subprocess management |
| PyYAML | YAML parsing |
🐙 Example Workflow
# Detect and list all projects
docker-captain list
# Choose which projects are active
docker-captain manage
# Start all active projects
docker-captain rally -d
💡 Inspiration
I've been using docker-compose.yaml files to manage my home server for a while.
I found the internet is full of tools to observe docker deployments, but I couldn't find one to manage my Docker Compose files.
I wanted something simple, lightweight, and portable.
I stumbled across jenssegers/captain, a Go project with a similar idea - a simple wrapper around docker compose, but only acting on one project at a time.
Given Python is my main language and the project hasn't seen any activity in 3 years, I decided to extend its scope and write docker-captain.
Hope this is useful to someone, happy sailing! ⛵
🔧 Development
If you want to contribute to the project, please start by opening an issue.
You can interact with the project via uv and the justfile (from casey/just) at the root of the repository.
Simply run just to show the available recipes.
# Create a virtual environment for the project
uv venv --all-groups
source .venv/bin/activate
# Linting, formatting, etc.
just # show the list of all commands
just lint
# Run docker-captain from the local folder
uv run docker-captain
Metadata
Release files for docker-captain 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| docker_captain-0.1.7.tar.gz | 12.2 kB | Without provenance | Details for docker_captain-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docker_captain-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for docker_captain-0.1.7-py3-none-any.whl |
Total release size: 26.8 kB
Release files / docker_captain-0.1.7.tar.gz
| Download URL | docker_captain-0.1.7.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
590726b90ac5db072d903b999d593d50a1f808a361bbd64a43a2019dc37733b4
|
|
BLAKE2b-256 checksum How to use checksums |
86c26c7194881a79fe2f89225ce5d4471bf43ec7535840f6a9a80fc1ae406e45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / docker_captain-0.1.7-py3-none-any.whl
| Download URL | docker_captain-0.1.7-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28511adbedea2a660b40acccdddb32a5805ab25b9695bd8547fa7c33cb842f33
|
|
BLAKE2b-256 checksum How to use checksums |
b01ffbf383cfb2f629f976d82416934847732cd045fb0fb1667c9b69e6751fac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for docker-captain 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.