Simple command interface to manage multiple Docker container
Project description
portmgr
portmgr is a wrapper around docker-compose that allows running typical docker-compose commands recursively. Additionally, it shortens commands to a single letter.
Let's say you have organized your compose files like this, you just add a dckrsub.yml in each parent folder:
docker/ ├── dckrsub.yml ├── reverse-proxy/ │ └── docker-compose.yml ├── storage │ ├── dckrsub.yml │ ├── nextcloud/ │ │ └── docker-compose.yml │ └── immich/ │ └── docker-compose.yml └── scripts
Each dckrsub.yml has a list of subdirectories, which portmgr should decend into.
For example, the dckrsub.yml in docker/ might look like this:
- reverse-proxy
- storage
And the dckrsub.yml in docker/storage/ like this:
- nextcloud
- immich
Now, if you run portmgr u in docker/ it will run docker compose up -d in reverse-proxy/, storage/nextcloud/ and storage/immich/.
portmgr starts from the current directory, so when running it in docker/storage/, it will run docker compose only in nextcloud/ and immich/. You can also use it in a directory with a docker-compose.yml as a shortener for docker-compose commands.
Commands
The following commands are available. The respective docker-compose commands are in brackets.
u Create and start containers (up)
p Pull images (pull)
s Stop services (stop)
d Stop and remove containers (down)
l Show container logs (logs)
a Run shell in container (exec -it <service> sh)
b Build images (build)
c List containers (ps)
t List processes in containers (top)
r Build and push to registry (build, push)
v Scan container images for vulnerabilities
e Encrypt/seal secret file(s) with age (requires portmgr[secrets])
x Decrypt/unseal sealed secret files (requires portmgr[secrets])
m Show secret migration status (requires portmgr[secrets])
You combine multiple commands. For example portmgr dul, runs docker compose with down, up and logs, thus stopping, removing and starting all containers and then showing the logs.
Installation
sudo pip install portmgr
Or build it from source (here using the latest commit on master branch)
sudo pip install https://github.com/Craeckie/portmgr.git
Sealing secrets
portmgr can encrypt secret-bearing files (.env, config files) with age so they are safe to commit to git. Decryption happens once at setup time; the plaintext files remain on disk for Docker to use normally.
Requires the secrets extra:
pip install portmgr[secrets]
Seal a file (run inside a service directory):
portmgr e .env
This creates .env.age, adds .env to the local .gitignore, and writes a .migrated marker. Commit the .age file and .migrated; never commit the plaintext.
Decrypt on a new server (run from any ancestor directory):
portmgr x
Recurses via dckrsub.yml and decrypts every *.age whose plaintext is missing. Pass --force to overwrite existing plaintext from the sealed copy.
Check migration progress:
portmgr m
Reports DONE, PENDING, INCONSISTENT, or CLEAN for each service and prints a summary tally.
Passphrase: portmgr prompts once and caches the passphrase for the rest of the run. For non-interactive use (e.g. in scripts or provisioning), set:
PORTMGR_PASSPHRASE=<passphrase> portmgr x
After running portmgr u, a footer line is printed if any services have not yet been sealed.
Tipps
If you use portmgr a lot like me, you might want to shorten it to one letter. For bash, you can add alias p='portmgr' to ~/.bashrc. For fish-shell you can add abbr p portmgr to ~/.config/fish/config.fish.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file portmgr-1.9.2.tar.gz.
File metadata
- Download URL: portmgr-1.9.2.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c34861804ed865ba6711f1f3c224a5319e496dc03bbb468ab4088c1a05ca5de
|
|
| MD5 |
50ae31026f1f5856562412d3f78b4ee8
|
|
| BLAKE2b-256 |
219f2f4a0fa307f8b49c6e31cfc8ee07104ac071a1f43f5ff5a78bd408fb4a6f
|
Provenance
The following attestation bundles were made for portmgr-1.9.2.tar.gz:
Publisher:
release.yml on Craeckie/portmgr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
portmgr-1.9.2.tar.gz -
Subject digest:
2c34861804ed865ba6711f1f3c224a5319e496dc03bbb468ab4088c1a05ca5de - Sigstore transparency entry: 1735922711
- Sigstore integration time:
-
Permalink:
Craeckie/portmgr@ffc6379c8f701c2bcff77cd40921d0b1414c3328 -
Branch / Tag:
refs/tags/v1.9.2 - Owner: https://github.com/Craeckie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ffc6379c8f701c2bcff77cd40921d0b1414c3328 -
Trigger Event:
push
-
Statement type:
File details
Details for the file portmgr-1.9.2-py3-none-any.whl.
File metadata
- Download URL: portmgr-1.9.2-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5452611d1af889b8ed6312b3980c677033d52e733f031581a77a5a42ebd48516
|
|
| MD5 |
e10d17d64f8a5b268cec3c71a382105b
|
|
| BLAKE2b-256 |
16f7dc32432758681129cd657123333c8220dfbc42cece56cbac9e5b7edf6b2e
|
Provenance
The following attestation bundles were made for portmgr-1.9.2-py3-none-any.whl:
Publisher:
release.yml on Craeckie/portmgr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
portmgr-1.9.2-py3-none-any.whl -
Subject digest:
5452611d1af889b8ed6312b3980c677033d52e733f031581a77a5a42ebd48516 - Sigstore transparency entry: 1735922735
- Sigstore integration time:
-
Permalink:
Craeckie/portmgr@ffc6379c8f701c2bcff77cd40921d0b1414c3328 -
Branch / Tag:
refs/tags/v1.9.2 - Owner: https://github.com/Craeckie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ffc6379c8f701c2bcff77cd40921d0b1414c3328 -
Trigger Event:
push
-
Statement type: