Skip to main content

Execute a command in a container

POST 

/node/:hostname/container/docker/:id/exec

Execute a command inside a running container on the target node.

Request

Path Parameters

    hostname stringrequired

    Possible values: non-empty

    Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).

    id stringrequired

    Possible values: non-empty, Value must match regular expression ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$

    Container identifier (name or ID). Must start with an alphanumeric character and may contain letters, digits, underscores, dots, and hyphens.

Body

required

The command to execute inside the container.

    command string[]required

    Command to execute inside the container.

    env string[]

    Additional environment variables in KEY=VALUE format.

    working_dir string

    Working directory inside the container.

Responses

Container exec accepted.

Schema

    job_id uuid

    The job ID used to process this request.

    results

    object[]

    required

  • Array [

  • hostname stringrequired

    The hostname of the agent.

    stdout string

    Standard output of the command.

    stderr string

    Standard error output of the command.

    exit_code integer

    Exit code of the command.

    changed boolean

    Whether the operation modified system state.

    error string

    Error message if the agent failed.

  • ]

Loading...