docker compose exec
Execute a command in a running container.
docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...]
This is the equivalent of
docker exec targeting a Compose service.
With this subcommand, you can run arbitrary commands in your services. Commands allocate a TTY by default, so
you can use a command such as
docker compose exec web sh to get an interactive prompt.
|Detached mode: Run command in the background.|
|Set environment variables|
|index of the container if service has multiple replicas|
|Keep STDIN open even if not attached.|
|Disable pseudo-TTY allocation. By default |
|Give extended privileges to the process.|
|Allocate a pseudo-TTY.|
|Run the command as this user.|
|Path to workdir directory for this command.|