v1

latestSwagger 2.02026-07-17107109407.9 KB
Exec

Create an exec instance

Run a command inside a running container.

post/containers/{id}/exec

Path parameters

idstring required

ID or name of container

Request body

AttachStdinboolean

Attach to stdin of the exec command.

AttachStdoutboolean

Attach to stdout of the exec command.

AttachStderrboolean

Attach to stderr of the exec command.

ConsoleSizeinteger[] nullable

Initial console size, as an [height, width] array.

DetachKeysstring

Override the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _.

Ttyboolean

Allocate a pseudo-TTY.

Envstring[]

A list of environment variables in the form ["VAR=value", ...].

Cmdstring[]

Command to run, as a string or array of strings.

Privilegedboolean

Runs the exec process with extended privileges.

Userstring

The user, and optionally, group to run the exec process inside the container. Format is one of: user, user:group, uid, or uid:gid.

WorkingDirstring

The working directory for the exec process inside the container.

Example request

{
  "AttachStdin": false,
  "AttachStdout": true,
  "AttachStderr": true,
  "DetachKeys": "ctrl-p,ctrl-q",
  "Tty": false,
  "Cmd": [
    "date"
  ],
  "Env": [
    "FOO=bar",
    "BAZ=quux"
  ]
}

Response

no error

Idstring required

The id of the newly created object.