docker-compose exec <service> <command...>
Execute a command in a running container
Arguments
Name | Description |
---|
service | |
command | |
Options
Name | Description |
---|
--detach, -d | Detached mode: Run command in the background |
--env, -e <key=value> | |
--index <index> | Index of the container if there are multiple instances of a service [default: 1] |
--interactive, -i | Keep STDIN open even if not attached |
--no-TTY, -T | Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY |
--privileged | Give extended privileges to the process |
--tty, -t | Allocate a pseudo-TTY |
--user, -u <user> | Run the command as this user |
--workdir, -w <workdir> | Path to workdir directory for this command |