docker_run
Execute and manage Docker containers by specifying images, commands, ports, volumes, and environment variables. Supports background execution, resource limits, and automatic removal.
Instructions
Run a Docker container
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Command arguments | |
| command | No | Command to run in container | |
| cpus | No | CPU limit (e.g., "0.5", "2") | |
| detach | No | Run container in background | |
| env | No | Environment variables as key-value pairs | |
| image | Yes | Docker image to run | |
| interactive | No | Keep STDIN open | |
| memory | No | Memory limit (e.g., "512m", "2g") | |
| name | No | Container name | |
| network | No | Network to connect container to | |
| ports | No | Port mappings (e.g., ["8080:80", "3000:3000"]) | |
| remove | No | Remove container when it exits | |
| restart | No | Restart policy (no, on-failure, always, unless-stopped) | |
| tty | No | Allocate a pseudo-TTY | |
| user | No | Username or UID (format: <name|uid>[:<group|gid>]) | |
| volumes | No | Volume mounts (e.g., ["/host/path:/container/path"]) | |
| working_dir | No | Working directory inside container |
Input Schema (JSON Schema)
{
"properties": {
"args": {
"description": "Command arguments",
"items": {
"type": "string"
},
"type": "array"
},
"command": {
"description": "Command to run in container",
"type": "string"
},
"cpus": {
"description": "CPU limit (e.g., \"0.5\", \"2\")",
"type": "string"
},
"detach": {
"description": "Run container in background",
"type": "boolean"
},
"env": {
"description": "Environment variables as key-value pairs",
"type": "object"
},
"image": {
"description": "Docker image to run",
"type": "string"
},
"interactive": {
"description": "Keep STDIN open",
"type": "boolean"
},
"memory": {
"description": "Memory limit (e.g., \"512m\", \"2g\")",
"type": "string"
},
"name": {
"description": "Container name",
"type": "string"
},
"network": {
"description": "Network to connect container to",
"type": "string"
},
"ports": {
"description": "Port mappings (e.g., [\"8080:80\", \"3000:3000\"])",
"items": {
"type": "string"
},
"type": "array"
},
"remove": {
"description": "Remove container when it exits",
"type": "boolean"
},
"restart": {
"description": "Restart policy (no, on-failure, always, unless-stopped)",
"type": "string"
},
"tty": {
"description": "Allocate a pseudo-TTY",
"type": "boolean"
},
"user": {
"description": "Username or UID (format: <name|uid>[:<group|gid>])",
"type": "string"
},
"volumes": {
"description": "Volume mounts (e.g., [\"/host/path:/container/path\"])",
"items": {
"type": "string"
},
"type": "array"
},
"working_dir": {
"description": "Working directory inside container",
"type": "string"
}
},
"required": [
"image"
],
"type": "object"
}