container_run
Run a Docker container from a specified image with configurable settings for ports, volumes, environment, and more.
Instructions
Run a container from an image.
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
| Name | Required | Description | Default |
|---|---|---|---|
| tty | No | ||
| name | No | ||
| user | No | ||
| image | Yes | ||
| ports | No | ||
| detach | No | ||
| labels | No | ||
| remove | No | ||
| command | No | ||
| network | No | ||
| volumes | No | ||
| hostname | No | ||
| cpu_count | No | ||
| mem_limit | No | ||
| entrypoint | No | ||
| privileged | No | ||
| stdin_open | No | ||
| auto_remove | No | ||
| environment | No | ||
| working_dir | No | ||
| extra_kwargs | No | ||
| restart_policy | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |