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
|Disable pseudo-TTY allocation. By default
docker compose exec allocates a TTY.
|Give extended privileges to the process
|Run the command as this user
|Path to workdir directory for this command