Skip to main content

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

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

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

portmgr-1.8.0.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

portmgr-1.8.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file portmgr-1.8.0.tar.gz.

File metadata

  • Download URL: portmgr-1.8.0.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for portmgr-1.8.0.tar.gz
Algorithm Hash digest
SHA256 1e692f5eb23f2f96bb03c2eb37afdcd683108790b2621a4f36e4d8a710361e0d
MD5 d87c779516fd2e097cf65d3d8955d8f1
BLAKE2b-256 4bdac56aed2bf19866eab9b9dce50def6520b1d46258110d4be7c71620a8dc03

See more details on using hashes here.

File details

Details for the file portmgr-1.8.0-py3-none-any.whl.

File metadata

  • Download URL: portmgr-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for portmgr-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d959ac1659aa3c25ce18ec79a65d26d92bf785125e5da85139182fbedfd5027
MD5 49ac1aff1fb6923d75be57634b7be652
BLAKE2b-256 2be47ce31ad5bc3e3cafdd80d8fe3ba754a35a0d7f713216fa8e6c5dbd793435

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page