Create an exec instance Run in API Explorer
Run a command inside a running container.
Body
Required
Exec configuration
-
Attach to
stdin
of the exec command. -
Attach to
stdout
of the exec command. -
Attach to
stderr
of the exec command. -
Initial console size, as an
[height, width]
array.At least
2
but not more than2
elements. Minimum value of each is0
. -
Override the key sequence for detaching a container. Format is a single character
[a-Z]
orctrl-<value>
where<value>
is one of:a-z
,@
,^
,[
,,
or_
. -
Allocate a pseudo-TTY.
-
A list of environment variables in the form
["VAR=value", ...]
. -
Command to run, as a string or array of strings.
-
Runs the exec process with extended privileges.
Default value is
false
. -
The user, and optionally, group to run the exec process inside the container. Format is one of:
user
,user:group
,uid
, oruid:gid
. -
The working directory for the exec process inside the container.
curl \
--request POST 'http://api.example.com/v1.49/containers/{id}/exec' \
--header "Content-Type: application/json" \
--data '{"Cmd":["date"],"Env":["FOO=bar","BAZ=quux"],"Tty":false,"DetachKeys":"ctrl-p,ctrl-q","AttachStdin":false,"AttachStderr":true,"AttachStdout":true}'
{
"Cmd": [
"date"
],
"Env": [
"FOO=bar",
"BAZ=quux"
],
"Tty": false,
"DetachKeys": "ctrl-p,ctrl-q",
"AttachStdin": false,
"AttachStderr": true,
"AttachStdout": true
}
{
"Id": "string"
}
{
"message": "No such container: c2ada9df5af8"
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}