dsh-container-manager: Container Management in DSH

Introduction

DSH is designed with the philosophy of “everything is a plugin.” For users running Podman or LXC locally, there is often a need for a centralized way to check container status, view logs, start/stop containers, and manage networking. Cockpit’s cockpit-podman can cover part of these needs, but changing ports requires rebuilding the container; for LXC, Cockpit has no ready-made tool; while the command line is flexible, it lacks a unified view and AI-assisted capabilities.

The dsh-container-manager plugin fills this gap in DSH: it provides a Cockpit-style panel for unified management of both Podman (rootless) and LXC, with AI tools to enhance operational efficiency.

Plugin Overview

  • Name: dsh-container-manager
  • Maintainer: Myer921
  • Category: Client
  • Core value: Manage local Podman and LXC via a browser-based panel within DSH, supporting port changes, log viewing, terminal access, and status monitoring.

It consists of two parts: a browser-side Cockpit-style panel, and a host-side set of AI tools, REST/WS interfaces, podman-compose integration, and an LXC privilege-escalation helper.

Dependencies & Runtime

The plugin depends on the following runtimes:

  • DSH: >=0.2.0
  • LXC (only required for LXC features): lxc (example version 5.0.2) + lxc-templates (example version 3.0.4.48)
  • podman-compose (optional): On the first up, if not present, a venv will be created in the data directory and podman-compose==1.6.0 installed; if installation fails, the panel will show a notice and degrade to read-only mode
  • skopeo: Used for checking image updates (if not installed, the panel will suggest apt install skopeo)

Frontend dependencies (all vendored, no network access):

  • xterm.js 5.5.0
  • xterm-addon-fit 0.10.0
  • yaml 2.9.1

Installation & Enablement

1. Add to Profile

cd ~/.dsh-next/profiles/web
pnpm add "link:/path/to/dsh-container-manager"
# Then add "dsh-container-manager" to dsh.profile.bundles in package.json
sudo systemctl restart dsh-next

After the restart, a “Containers” entry will appear in the left sidebar.

2. LXC Helper (Optional)

Installing the plugin alone will not affect LXC: without the helper, the local-lxc node will show HELPER_DOWN.

First, preview what the installation script will do:

sudo bash helper/install-helper.sh --dry-run

Run the installation:

sudo bash helper/install-helper.sh

It will:

  1. Install lxc and lxc-templates (skip with --no-lxc)
  2. Install dsh-lxcd.mjs and net-config.mjs to /usr/local/lib/dsh-container-manager/
  3. Install and enable dsh-lxcd.service
  4. Create the socket /run/dsh-container-manager/lxcd.sock with permissions srw-rw---- root:dsh

Uninstall:

sudo bash helper/install-helper.sh --uninstall

Note: Do not run dsh-lxcd.mjs manually in the foreground — it will unlink the socket the service is using and then listen on it itself. After Ctrl-C, the service process is still alive but nobody can connect, resulting in all API calls timing out. If this happens, run sudo systemctl restart dsh-lxcd.

After installing the plugin, go to the panel’s “Projects” page and fill in the root directory on the first card, e.g. /opt/dsh-container. The plugin will create two subdirectories underneath:

/opt/dsh-container/
  podman/                  ← one top-level subdirectory per compose project
  lxc/                     ← LXC mount-point convention directory

There are three conventions:

  1. Only top-level subdirectories are recognized; no deeper nesting. For example, podman/ukulele/src/compose.yaml is NOT a project — you must move the entire ukulele directory to sit directly under podman/.
  2. The compose file must reside directly in the subdirectory; it cannot be buried in a deeper layer like deploy/.
  3. The project display name = the subdirectory name; this name is also used as the compose project name (-p), and will be normalized to lowercase with only [a-z0-9_-] characters retained.

What the Panel Can Do

Top navigation: Podman / LXC / Host Networking / Health Check / Activity. Each runtime gets its own dedicated page with no mixed layout.

Podman Page

Sub-tabs: Projects / Containers / Images / Volumes / Networks / Pods / Secrets / Quadlet.

Projects (Compose)

  • Root directory: If not configured, the entire page shows a single card saying “Set the root directory first.” Once set, the plugin will create podman/ and lxc/ automatically; if it cannot, it will provide the mkdir -p + chown commands.
  • Project cards: One card per top-level subdirectory, showing service count / running count / ports. If the compose file is malformed, it will be highlighted in red with the exact line and column numbers.
  • Service table: Service name, image, container, status, published ports. Only modified services are rebuilt.
  • Per-service pull & recreate: Clicking “Pull & Recreate” first pulls that service’s image, then runs up -d --force-recreate --no-deps <service> — affecting only that one service.
  • Port editing: Modify host:container[/udp] in the visual editor; when writing back to YAML, comments are preserved, a .bak backup is auto-created, and up is only executed when you click “Apply.”
  • YAML source: Edit the entire compose file directly; validation runs before writing; if parsing fails, a 400 is returned and nothing is written to disk.
  • Logs: Read directly from the container, bypassing podman-compose logs (which outputs nothing for a specific service in 1.6.0).
  • Migration: Adopt manually started podman run containers into a managed project. A preview shows “which container will be removed, which will be recreated,” and changes are only made after confirmation.

Containers / Images / Volumes / Networks

  • Node bar: One chip per runtime — green for available, gray for unavailable (hover to see the reason).
  • Container list: Name / status / image, with inline start/stop controls.
  • Overview: Status, image, ports, mounts, networks (including IP/MAC), and environment variable key names.
  • Create container: For Podman — specify image/ports/env vars/mounts/command/restart policy/memory/CPU; for LXC — specify distro/version/architecture/bridge/IP mode/memory limit, with optional auto-start after creation and boot-time auto-start.
  • Resource limits (Podman): Memory / CPU input fields in the overview call podman update; after saving, the actual cgroup values inside the container are read back to verify.
  • Private registry: The Images page supports login; passwords are passed via podman login --password-stdin.
  • Volume backup/restore: The Volumes page allows packaging a named volume to a host directory, or restoring from an archive; restore requires confirmation.
  • Terminal: WebSocket-based; Podman uses podman exec -it, LXC uses lxc-attach.
  • Log follow: Container logs support 2-second incremental polling, pause, and auto-scroll.
  • Update rollback: Before a per-service pull & recreate, the old image ID is recorded; the service row includes a direct rollback button.
  • Images: List, pull, delete (delete requires confirmation).
  • Check updates: Compares local image digest against the remote digest; three states: “Current” / “Update available” / “Incomparable.” “Incomparable” does not mean “already latest”; if skopeo is not installed, a prompt to install it is shown.
  • Secrets (Podman secrets): Only name / driver / timestamp are listed; values can never be read back.
  • Quadlet: Lists units in systemd directories, shows the expanded podman run parameters, and allows starting/stopping units.

LXC Page

Sub-tabs: Containers / Images / Networks / Storage / Backups.

Containers

  • Overview / Logs / Files / Diagnostics / Config / Terminal; snapshots and mounts are in the Config tab.
  • Files: List directory, read (text shown inline, binaries show size), write (≤8MB), create directory, delete. The loop backend goes through lxc-attach; the dir backend reads the host rootfs directly; both paths perform real-path validation to prevent escaping the container root. AI-side writes / deletes are always held pending (single request ≤256KB).
  • Diagnostics: Runs a 7-step network check inside the container (interfaces / routes / resolv.conf / hosts / DNS resolution / ping / TCP port connect). Results are categorized as “OK / Issue found / Inconclusive.”
  • Config: All 15 fields are editable in the panel, including hostname, auto-start on boot, start order & delay, init command, dropped capabilities, CPU pinning, CPU quota/weight, memory hard/soft limits, swap, OOM group, PID limit, IO weight. Resource-related fields take effect immediately; capDrop / initCmd / startOrder / startDelay only write to the config file, and the response will flag restartRequired.
  • Snapshots / Mounts / Clone: Create snapshot, roll back, delete; lxc.mount.entry one line per mount; full clone (source must be stopped first).
  • Terminal: Uses lxc-attach.

Images (System Image Cache)

This is NOT the same as Podman’s “Images.” LXC containers are extracted from a shared compressed rootfs archive; the “images” here refer to the system image cache, stored at:

/opt/dsh-container/lxc/image/download/<distro>/<version>/<arch>/<variant>/rootfs.tar.xz

AI Tools & Security

The plugin provides 36 AI tools, but dangerous operations are queued in a “Pending Confirmation” drawer — they only execute after a manual “Confirm” click. All AI-side writes / deletes are held pending; simply use the panel directly for those.

For LXC, the DSH process itself runs with CapEff=0 + NoNewPrivs=1 and cannot execute lxc-start or modprobe. Privilege escalation is delegated to a whitelisted systemd service dsh-lxcd.service, rather than passing sudo to the model.

Use Cases & Notes

Suitable for users managing local Podman or LXC containers within DSH, especially those who need a graphical panel combined with AI-assisted operations.

Note: The plugin runs with the privileges of the current dsh process; review the source code and license before installing. LXC functionality requires a separately installed helper.

Summary

dsh-container-manager provides a Cockpit-style container management panel within DSH, offering a unified view and operations for both Podman (rootless) and LXC. Through podman-compose integration, ports can be changed visually and applied with one click; through the LXC helper, DSH can safely operate LXC containers. Combined with AI tools and the pending-confirmation mechanism, daily operational efficiency can be improved without compromising security.

Repository & Source

  • Plugin directory page: https://www.skillhub.cn/plugins/Myer921/dsh-container-manager
  • GitHub: https://github.com/Myer921/dsh-container-manager
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye