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.3.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: portmgr-1.8.3.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for portmgr-1.8.3.tar.gz
Algorithm Hash digest
SHA256 9166c9bb83d150ae53a2e14ab43cbbdfe16f93d59958d67c41b148ea1002881e
MD5 2c8e9b3ed56bc99a65f085f09341cf69
BLAKE2b-256 6fd92391bad774e54dbee8ab88a5b2dba667961184ea7e3388c3247fb07c0e72

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for portmgr-1.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8493df9644b0cd60f077ce3271fb44c4d4be948fed3e22a58635f9624ecffa24
MD5 d41898ccda0a0f6b1a53026dad0a0027
BLAKE2b-256 7c55eaff39e4512617fb351282549f1dac93790e3296cd5fa2626bc1c05d7790

See more details on using hashes here.

Supported by

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