TOOL » VIRTUAL_ENVIRONMENT » DOCKER_COMPOSE

Exec

Usage

Execute a command in a running container.

shell
docker-compose run OPTIONS SERVICE COMMAND
OptionDescription
-d --detachDetached mode: Run container in the background.
-e --envSet an environment variable (can be used multiple times).
-T --no-TTYDisable pseudo-tty allocation.
-u --userRun as specified username or uid.
-w --workdirWorking directory inside the container.

Example

Run a command with an environment variable.

shell
docker-compose exec -e DEBUG=1 app bash