Skip to main content
Glama

container_run

Run a Docker container from an image with a single command, supporting detach, port mapping, volumes, environment variables, and other Docker run options.

Instructions

Run a container from an image (create and start in one call, like docker run).

Use container_create to prepare a container without starting it, or container_exec to run a command in a container that already exists. With detach=False the call blocks until the container exits and returns its output, so long-running images need detach=True. Created containers are stamped with provenance labels.

args: image - The image to run command - The command to run in the container name - Name to assign to the container detach - Run in the background and return container info environment - Environment variables to set ports - Port mappings, e.g. {'2222/tcp': 3333} volumes - Volumes to mount network - Name of the network to attach hostname - Optional hostname for the container user - Username or UID to run as working_dir - Working directory inside the container entrypoint - Entrypoint to override the image default restart_policy - Restart policy, e.g. {'Name': 'on-failure', 'MaximumRetryCount': 3} labels - Labels to set on the container remove - Remove the container when it exits (only with detach=False) auto_remove - Enable auto-removal of the container on daemon side privileged - Give extended privileges to the container tty - Allocate a pseudo-TTY stdin_open - Keep STDIN open mem_limit - Memory limit cpu_count - Number of CPUs extra_kwargs - Additional keyword arguments forwarded to ContainerCollection.run (call docs_lookup(section="containers") for the full accepted set) returns: dict | str - Container attrs when detach=True, otherwise stdout/stderr as a string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ttyNo
nameNo
userNo
imageYes
portsNo
detachNo
labelsNo
removeNo
commandNo
networkNo
volumesNo
hostnameNo
cpu_countNo
mem_limitNo
entrypointNo
privilegedNo
stdin_openNo
auto_removeNo
environmentNo
working_dirNo
extra_kwargsNo
restart_policyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate non-readonly and non-destructive. The description adds behavioral details: blocking behavior when detach=False, return value types, provenance labels. Could mention error handling or side effects more, but generally sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured: opening analogy, separation from siblings, behavior note, then alphabetically listed params with concise descriptions. No redundancy, front-loaded with key information. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (22 params, output schema exists), the description covers main behavior, return types, and even directs to docs_lookup for extra_kwargs. Lacks explicit error handling or edge cases, but overall adequately complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides one-line explanations for all 22 parameters (e.g., 'The image to run', 'Port mappings, e.g. {\'2222/tcp\': 3333}'). Adds meaning beyond the bare schema, though some complex params (environment, volumes) could use more detail.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool does 'Run a container from an image (create and start in one call, like `docker run`)'. It distinguishes itself from sibling tools `container_create` (prepare without starting) and `container_exec` (run command in existing container), leaving no ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit guidelines: use `container_create` to prepare without starting, `container_exec` for commands in existing containers. Mentions `detach=True` for long-running images. Provides clear when-to-use and when-not-to-use context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GavinLucas/docker-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server