Files
scripts/pm-task.md
2026-04-09 15:29:24 +08:00

28 lines
1.4 KiB
Markdown

# 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` / `up` : Runs `docker compose up` command
- `stop` / `down` : 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
- `reload` : Reloads the nginx service if the container is running
- `build` / `rebuild` : Builds containers with `docker compose build`, optionally restarts containers, and reloads nginx
- `upgrade` : Pulls latest images and upgrades containers with `docker compose up -d --remove-orphans --force-recreate`
- `--help` : Displays available tasks and usage information