一键导入
working-with-podman-runtime-config
Guide to configuring the Podman runtime including image setup, agent configuration, and containerfile generation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide to configuring the Podman runtime including image setup, agent configuration, and containerfile generation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add a new runtime implementation to the kdn runtime system
Guide to using the instances manager API for workspace management and project detection
Guide to understanding and working with the kdn runtime system architecture
Conventional Commit Message Generator
Guide to the autoconf package — how secret detection, filtering, and the runner are wired together, and how to extend the system with new detector types
Guide to workspace configuration for environment variables, mount points, skills, MCP servers, secrets and network access at multiple levels
| name | working-with-podman-runtime-config |
| description | Guide to configuring the Podman runtime including image setup, agent configuration, and containerfile generation |
| argument-hint |
The Podman runtime supports configurable image and agent settings through JSON files. This is runtime-specific configuration that controls how the Podman container is built and configured.
What this config system controls:
What this does NOT control:
/working-with-config-system for workspace configuration (env vars, mounts)The Podman runtime configuration allows customization of the base image, installed packages, sudo permissions, and agent setup through JSON files stored in the runtime's storage directory.
pkg/runtime/podman/config/config.go): Interface for managing Podman runtime configurationpkg/runtime/podman/config/types.go): Base image configuration (Fedora version, packages, sudo binaries, custom RUN commands)pkg/runtime/podman/config/types.go): Agent-specific configuration (packages, RUN commands, terminal command)pkg/runtime/podman/config/defaults.go): Default configurations for image and agents (Claude, Goose, Cursor, OpenCode, OpenClaw)Configuration files are stored in the runtime's storage directory:
<storage-dir>/runtimes/podman/config/
├── image.json # Base image configuration
├── claude.json # Claude agent configuration
├── goose.json # Goose agent configuration
├── opencode.json # OpenCode agent configuration
└── openclaw.json # OpenClaw agent configuration
{
"version": "latest",
"packages": ["which", "procps-ng", "wget2", "@development-tools", "jq", "gh", "golang", "golangci-lint", "python3", "python3-pip"],
"sudo": ["/usr/bin/dnf", "/bin/nice", "/bin/kill", "/usr/bin/kill", "/usr/bin/killall"],
"run_commands": []
}
Fields:
version (required) - Fedora version tag (e.g., "latest", "40", "41")packages (optional) - DNF packages to installsudo (optional) - Absolute paths to binaries the user can run with sudo (creates single ALLOWED Cmnd_Alias)run_commands (optional) - Custom shell commands to execute during image build (before agent setup)Agent configurations are named <agent-name>.json. The Podman runtime provides default configurations for Claude Code, Goose, Cursor, OpenCode, and OpenClaw.
claude.json - Claude Code Agent:
{
"packages": [],
"run_commands": [
"curl -fsSL --proto-redir '-all,https' --tlsv1.3 https://claude.ai/install.sh | bash",
"mkdir -p /home/agent/.config"
],
"terminal_command": ["claude"]
}
goose.json - Goose Agent:
{
"packages": [],
"run_commands": [
"cd /tmp && curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | CONFIGURE=false bash"
],
"terminal_command": ["goose"]
}
opencode.json - OpenCode Agent:
{
"packages": [],
"run_commands": [
"cd /tmp && curl -fsSL https://opencode.ai/install | bash",
"mkdir -p /home/agent/.local/bin && ln -sf /home/agent/.opencode/bin/opencode /home/agent/.local/bin/opencode",
"mkdir -p /home/agent/.config/opencode"
],
"terminal_command": ["opencode"]
}
openclaw.json - OpenClaw Agent:
{
"packages": [],
"run_commands": [
"curl -fsSL https://openclaw.ai/install-cli.sh | bash",
"mkdir -p /home/agent/.local/bin && ln -sf /home/agent/.openclaw/bin/openclaw /home/agent/.local/bin/openclaw"
],
"terminal_command": ["sh", "-c", "curl -sf http://127.0.0.1:18789/ >/dev/null 2>&1 || { openclaw gateway run >/dev/null 2>&1 & for i in $(seq 1 30); do curl -sf http://127.0.0.1:18789/ >/dev/null 2>&1 && break; sleep 0.5; done; }; openclaw"],
"env_vars": {
"OPENCLAW_PROXY_ACTIVE": "1",
"NODE_NO_WARNINGS": "1"
}
}
Fields:
packages (optional) - Additional packages for the agent (merged with image packages)run_commands (optional) - Commands to set up the agent (executed after image setup)terminal_command (required) - Command to launch the agent (must have at least one element)import "github.com/openkaiden/kdn/pkg/runtime/podman/config"
// Create config manager (in Initialize method)
configDir := filepath.Join(storageDir, "config")
cfg, err := config.NewConfig(configDir)
if err != nil {
return fmt.Errorf("failed to create config: %w", err)
}
// Generate default configs if they don't exist
if err := cfg.GenerateDefaults(); err != nil {
return fmt.Errorf("failed to generate defaults: %w", err)
}
// Load configurations (in Create method)
imageConfig, err := cfg.LoadImage()
if err != nil {
return fmt.Errorf("failed to load image config: %w", err)
}
// Load agent config (use the agent name: "claude", "goose", etc.)
agentConfig, err := cfg.LoadAgent("claude")
if err != nil {
return fmt.Errorf("failed to load agent config: %w", err)
}
The config system validates:
version (ImageConfig) and terminal_command (AgentConfig)claude.ai/install.shgithub.com/block/gooseopencode.ai/installopenclaw.ai/install-cli.sh; the terminal command uses sh -c to start the gateway in the background on port 18789 (waiting up to 15s for readiness) then opens the openclaw CLIThe config system is used to generate Containerfiles dynamically:
import "github.com/openkaiden/kdn/pkg/runtime/podman"
// Generate Containerfile content from configs
// hasAgentSettings = true adds a COPY instruction for default settings files
containerfileContent := generateContainerfile(imageConfig, agentConfig, hasAgentSettings)
// Generate sudoers file content from sudo binaries
sudoersContent := generateSudoers(imageConfig.Sudo)
The generateContainerfile function creates a Containerfile with:
registry.fedoraproject.org/fedora:<version>agent:agent)ALLOWED Cmnd_AliashasAgentSettings is true: COPY --chown=agent:agent agent-settings/. /home/agent/ (placed before RUN commands)When runtime.CreateParams.AgentSettings is non-empty, createContainerfile() writes the map entries as files into an agent-settings/ subdirectory of the build context (the instance directory), then sets hasAgentSettings = true so generateContainerfile emits a COPY instruction.
Build context (instance dir):
├── Containerfile
├── sudoers
└── agent-settings/ ← created from CreateParams.AgentSettings
└── .claude.json ← key ".claude.json", value = file contents
The COPY --chown=agent:agent agent-settings/. /home/agent/ instruction is placed before all RUN commands from both image.json and the agent config, so that agent install scripts can read and build upon the defaults (e.g., the Claude install script may modify settings files, which is expected behavior).
This mechanism is populated by manager.readAgentSettings() in pkg/instances/manager.go, which walks <storage-dir>/config/<agent>/ and passes the result as AgentSettings in CreateParams.
These values are not configurable:
registry.fedoraproject.org/fedora (only version tag is configurable)agentagentgoose.json, cursor.json)/working-with-config-system - Workspace configuration (env vars, mounts)/working-with-runtime-system - Runtime system architecture/add-runtime - Creating new runtimespkg/runtime/podman/config/config.gopkg/runtime/podman/config/types.gopkg/runtime/podman/config/defaults.gopkg/runtime/podman/