docker-agent-packaging

docker-agent-packaging is a skill for Claude Code, Codex from phazurlabs/install-labs. It costs 96 tokens per session (6,639 once invoked), scanned C, original, Apache-2.0.

A guide for packaging an AI agent or automation inside Docker, a tool that bundles software with its environment so it can run consistently on another machine.

In plain words
What is it for?
Use it to create Dockerfiles or Docker Compose setups for server agents, multi-service agents, GPU workloads, or shared development environments.
Why use it?
It helps avoid dependency conflicts and “works on my machine” problems, especially when the agent needs machine-learning libraries, several services, or a GPU.

Skill for Claude CodeCodex

Part of the install-labs plugin — 12 skills, 10 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/phazurlabs/install-labs/docker-agent-packaging
Any agent
npx skills add phazurlabs/install-labs --skill docker-agent-packaging
Clone the repo
git clone --depth 1 https://github.com/phazurlabs/install-labs

Made for: Claude Code, Codex.

Or install install-labs, the plugin that ships this one along with the rest of its 12 skills, 10 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for docker-agent-packaging

README.md
[![agentmods](https://agentmods.dev/badge/skills/phazurlabs/install-labs/docker-agent-packaging.svg)](https://agentmods.dev/skills/phazurlabs/install-labs/docker-agent-packaging)
Your own site
<a href="https://agentmods.dev/skills/phazurlabs/install-labs/docker-agent-packaging"><img src="https://agentmods.dev/badge/skills/phazurlabs/install-labs/docker-agent-packaging.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,639 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00096 $0.06639
Opus 5 $0.00048 $0.03320
Sonnet 5 $0.00019 $0.01328
Haiku 4.5 $0.00010 $0.00664

Measured 4d ago against content hash 510458a3f059, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

docker-agent-packaging scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf /var/lib/apt/lists/*

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

apt-get install -y --no-install-recommends libpq5 curl && \
skills/docker-agent-packaging/SKILL.md · 820 lines

How it starts

The opening of the file, as written. The whole thing — 820 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Docker Agent Packaging

When to Use Docker for Agents

Docker is the right choice when your agent has requirements that exceed what a simple package manager can handle. Use this decision framework:

Situation Use Docker? Why
Complex ML dependencies (PyTorch, transformers, CUDA) Yes Reproducible environment eliminates "works on my GPU"
Multi-service architecture (agent + vector store + DB) Yes Compose orchestrates the full stack in one command
Server-side agent (API endpoint, webhook handler) Yes Standard deployment target for every cloud platform
GPU inference required Yes nvidia-container-toolkit provides clean GPU passthrough
Team needs identical dev environments Yes Dev containers eliminate onboarding friction
Simple CLI tool with few deps No Use a single binary (Go/Rust) or uvx/npx
Agent is just an MCP server No Use npm/PyPI; MCP clients handle lifecycle
Users are non-technical without Docker installed No Docker itself is a prerequisite most non-devs don't have
Lightweight Python script calling APIs No pip install or uvx is faster with zero overhead

Rule of thumb: if your agent needs more than one process or has dependencies that fight each other across machines, Docker is the answer. If it is a single-process CLI tool, Docker adds overhead without value.


Dockerfile for Python AI Agents

Multi-stage builds keep your runtime image small by separating build-time tools from the final artifact.

# =============================================================================
# Stage 1: Build — install dependencies in an isolated layer
# =============================================================================
FROM python:3.12-slim AS builder

# Prevent Python from writing .pyc files and enable unbuffered output
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

WORKDIR /app

# Install system-level build dependencies (removed in runtime stage)
RUN apt-get update && \
    apt-get install -y --no-install-recommends gcc libpq-dev && \
    rm -rf /var/lib/apt/lists/*

# Copy dependency manifest first (layer caching: deps change less than code)
COPY requirements.txt .

# Install Python dependencies into a virtual environment
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir -r requirements.txt

# =============================================================================
# Stage 2: Runtime — minimal image with only what's needed to run
# =============================================================================
FROM python:3.12-slim AS runtime

# Runtime system deps only (no compiler)
RUN apt-get update && \
    apt-get install -y --no-install-recommends libpq5 curl && \
    rm -rf /var/lib/apt/lists/*

# Create non-root user (never run agents as root)
RUN groupadd --gid 1000 agent && \
    useradd --uid 1000 --gid agent --shell /bin/bash --create-home agent

WORKDIR /app

# Copy virtual environment from builder
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Copy application source
COPY --chown=agent:agent . .

# Switch to non-root user
USER agent

# Expose the agent's API port (change to match your agent)
EXPOSE 8000

# Health check — container orchestrators use this to know if agent is alive
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:8000/health || exit 1

# API keys are NEVER baked into the image — pass at runtime via -e or .env
# ENV ANTHROPIC_API_KEY=  (do NOT set a default value)

# Start the agent
CMD ["python", "-m", "my_agent.server"]

Read the full file on GitHub · 820 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 820 lines · 96 tokens per session scan C 510458a3f059

Subscribe to this mod's changes

docker-agent-packaging is a skill published in the GitHub repository phazurlabs/install-labs (3 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 96 tokens to every session and 6,639 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.