Skip to main content
Executes a command inside a running container. It uses the same process flags as container run to control environment, user, and TTY settings.

Usage

container exec [--detach] [--env <env> ...] [--env-file <env-file> ...] [--gid <gid>] [--interactive] [--tty] [--user <user>] [--uid <uid>] [--workdir <dir>] [--debug] <container-id> <arguments> ...

Arguments

container-id
string
required
Container ID
arguments
string[]
required
New process arguments

Options

-d, --detach
boolean
Run the process and detach from it

Process options

-e, --env
string
Set environment variables (format: key=value)
--env-file
string
Read in a file of environment variables (key=value format, ignores # comments and blank lines)
--gid
number
Set the group ID for the process
-i, --interactive
boolean
Keep the standard input open even if not attached
-t, --tty
boolean
Open a TTY with the process
-u, --user
string
Set the user for the process (format: name|uid[:gid])
--uid
number
Set the user ID for the process
-w, --workdir, --cwd
string
Set the initial working directory inside the container

Build docs developers (and LLMs) love