Create
Create a new container on the target node from the specified image:
$ osapi client container docker create --image nginx:latest
Job ID: 550e8400-e29b-41d4-a716-446655440000
Hostname: server1
Container ID: a1b2c3d4e5f6
Name: eager_turing
Image: nginx:latest
State: running
Create a named container with environment variables, port mappings, and volume mounts:
$ osapi client container docker create \
--image nginx:latest \
--name my-nginx \
--env "PORT=8080" --env "DEBUG=true" \
--port "8080:80" --port "8443:443" \
--volume "/data:/var/lib/data"
Create a container without starting it immediately:
$ osapi client container docker create \
--image alpine:latest \
--name my-alpine \
--auto-start=false
Target a specific host:
$ osapi client container docker create \
--image redis:7 \
--name cache \
--target web-01
JSON Output
Use --json to get the full API response:
$ osapi client container docker create --image nginx:latest --json
Flags
| Flag | Description | Default |
|---|---|---|
--image | Container image reference (required) | |
--name | Optional name for the container | |
--env | Environment variable in KEY=VALUE format (repeatable) | [] |
--port | Port mapping in host:container format (repeatable) | [] |
--volume | Volume mount in host:container format (repeatable) | [] |
--auto-start | Start the container immediately after creation | true |
-T, --target | Target: _any, _all, hostname, or label (group:web) | _any |
-j, --json | Output raw JSON response |