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

This version

1.6.4

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: portmgr-1.6.4.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for portmgr-1.6.4.tar.gz
Algorithm Hash digest
SHA256 1435a765f916d1b444f4ce077e99b631e92221ac9dab510a94484741029c456f
MD5 3f51794ab9405d2d2ad2295012b74295
BLAKE2b-256 27a108c0a475f56e3275323cd3f694a0627b7b5d7fbe1702c75c844b6bb23e66

See more details on using hashes here.

File details

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

File metadata

  • Download URL: portmgr-1.6.4-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for portmgr-1.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8b70a1fb2c4297a5983036c4a2d2d3ea4a61334d43fb2a549c10765a0f6581b0
MD5 9f21434cc9ef4666f5c55b7328118ef6
BLAKE2b-256 a1ad3b9689c43fb31c614bf02ec699f84cba54ba15004fd7322f3a08ec3c51d7

See more details on using hashes here.

Supported by

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