New pm-task script.

This commit is contained in:
Ali
2026-04-09 15:12:08 +08:00
parent 05457bca08
commit b1be74b662
4 changed files with 496 additions and 347 deletions

26
pm-task.md Normal file
View File

@@ -0,0 +1,26 @@
# Container Management Tasks Docker or Podman
## Purpose
To work with Podman, simply make `docker` an alias to the `podman` command.
## Configuration
- Config file: `$HOME/.config/pm-task.conf`
- Config key `workspace` stores Docker/Podman projects workspace directory
- Prompts user for input if not set, creates config file if it doesn't exist
## Tasks
Tasks are defined in the first argument.
- `(none)` : Shows a numbered list menu of all subdirectories under the workspace directory, navigates to the selected directory, and runs `ls -lah`
- `restart` : Runs `docker compose down`, `sleep 1`, and `docker compose up` commands
- `start` : Runs `docker compose up` command
- `stop` : Runs `docker compose down` command
- `ps` : Runs `watch docker ps` to monitor running containers
- `stats` : Runs `docker stats` to monitor container resource usage
- `logs` / `log` : Runs `docker logs -f <container_name>` to follow container logs
- `sh` / `bash` / `shell` : Runs `docker exec -it <container_name> bash` to access container shell
- `build` / `rebuild` : Builds containers with `docker compose build`, optionally restarts containers, and reloads nginx
- `--help` : Displays available tasks and usage information