← 返回
未分类

Unraid XML Generator

Generate Unraid DockerMan user template XML files from structured input. Use when: the user asks to "生成 Unraid XML 模板", "创建 Docker 模板", "为 XXX 写 Unraid 模板",...
根据结构化输入生成 Unraid DockerMan 用户模板 XML 文件。使用时机:用户要求“生成 Unraid XML 模板”“创建 Docker 模板”“为 XXX 写 Unraid 模板”等。
ashanzzz ashanzzz 来源
未分类 clawhub v1.0.1 1 版本 99703.3 Key: 无需
★ 0
Stars
📥 336
下载
💾 0
安装
1
版本
#docker#latest#template#unraid#xml

概述

Unraid XML Generator

Core Pattern

The key insight for Unraid Docker templates:

<Container version="2">
  <Name>mycontainer</Name>
  <Repository>image:tag</Repository>
  <Network>bridge</Network>

  <!-- KEY: override ENTRYPOINT to /bin/sh -->
  <ExtraParams>--entrypoint /bin/sh</ExtraParams>

  <!-- KEY: pass real startup command through shell -ec -->
  <PostArgs>-ec 'real startup command here'</PostArgs>

  <!-- User-configurable variables -->
  <Config Name="Display Name" Target="ENV_VAR" Default="..." Type="Variable" Display="always" Required="false" Mask="true">default_value</Config>
  <Config Name="Port" Target="PORT" Default="8080" Mode="tcp" Type="Port" Display="always" Required="true">8080</Config>
  <Config Name="Data Path" Target="/data" Default="/mnt/user/appdata/mycontainer" Mode="rw" Type="Path" Display="always" Required="true">/mnt/user/appdata/mycontainer</Config>
</Container>

Template Field Reference

FieldPurpose
----------------
Unique container identifier
Docker image with tag
Registry URL (optional, informational)
Network mode: bridge, host, none
Default shell (bash / sh)
Extra docker run flags (e.g. --entrypoint /bin/sh)
Startup command passed to shell -ec
Format: http://[IP]:[PORT:nnnn]/ — shows button in Unraid UI
URL to icon image
Unraid category string
User-configurable parameter

Config Types

TypeExample
---------------
VariableEnvironment variable (Target = env var name)
PortPort mapping (Mode="tcp"/"udp")
PathVolume path (Mode="rw"/"ro")
SliderNumeric slider (requires Min, Max, Step)
DescriptionRead-only description text

Config Display Options

Display valueWhen shown
---------------------------
alwaysAlways visible in UI
advancedHidden behind "Advanced" toggle
hiddenNever shown (manual config)

Masked Variables (secrets)

Set Mask="true" on Type="Variable" Config entries to:

  • Hide the value from the UI (shown as ••••••)
  • Treat as sensitive (API keys, tokens, passwords)

PostArgs Shell Pattern

# Correct way to write PostArgs in XML:
<PostArgs>-ec 'export VAR1="value1" && export VAR2="value2" && exec real_command --flag arg'</PostArgs>

# Breaking down:
# -e  : exit on error
# -c  : read command from string (not stdin)
# '...' : single-quoted command string

Standard Config Variables to Include

For any container:

<Config Name="HTTP Proxy" Target="HTTP_PROXY" Default="" Type="Variable" Display="advanced" Required="false" Mask="false">http://192.168.8.30:7893</Config>
<Config Name="HTTPS Proxy" Target="HTTPS_PROXY" Default="" Type="Variable" Display="advanced" Required="false" Mask="false">http://192.168.8.30:7893</Config>
<Config Name="NO Proxy" Target="NO_PROXY" Default="" Type="Variable" Display="advanced" Required="false" Mask="false">localhost,127.0.0.1,192.168.0.0/16</Config>
<Config Name="TZ" Target="TZ" Default="Asia/Shanghai" Type="Variable" Display="advanced" Required="false" Mask="false">Asia/Shanghai</Config>

Script Usage

python3 scripts/generate_template.py \
  --name opencode \
  --image ghcr.io/anomalyco/opencode:latest \
  --port 4096 \
  --web-port 4097 \
  --output /tmp/opencode.xml

# Generate with all standard env vars:
python3 scripts/generate_template.py \
  --name opencode \
  --image ghcr.io/anomalyco/opencode:latest \
  --port 4096 \
  --web-port 4097 \
  --proxy 192.168.8.30:7893 \
  --tz Asia/Shanghai \
  --output /tmp/opencode.xml

Common Pitfalls

  1. Double quotes in PostArgs → escape as " in XML
  2. ENTRYPOINT bypass → always use --entrypoint /bin/sh
  3. Shell variable substitution → use single quotes for PostArgs to prevent $VAR expansion by XML parser
  4. Template filename → must start with my- and end with .xml
  5. Path permissions → Unraid runs containers as PUID/PGID = 99/100 by default

Output

The generated XML file is placed at:

/boot/config/plugins/dockerMan/templates-user/my-<name>.xml

User must confirm before deploying (writing) to that path.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 17:12 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Skill Creator

ashanzzz
用于创建、编辑、改进或审核 OpenClaw AgentSkill。触发场景包括:创建技能、编写技能、改进或审查技能、整理目录及迁移文件。
★ 0 📥 674

Verified Research

ashanzzz
深入多源核实研究,分解复杂问题,优先获取高可信度来源,校验时效性,生成结构化报告,支持三天缓存。
★ 0 📥 301

Sure API

ashanzzz
Use the we-promise/sure REST API with X-Api-Key auth. Covers accounts, transactions, categories, tags, merchants, import
★ 0 📥 343