docker exec

Execute a command on an already running Docker container. More information: https://docs.docker.com/reference/cli/docker/container/exec/.

docker exec --interactive --tty {{container_name}} {{/bin/bash}}

docker exec --detach {{container_name}} {{command}}

docker exec --interactive --tty --workdir {{path/to/directory}} {{container_name}} {{command}}

docker exec --interactive --detach {{container_name}} {{command}}

docker exec --interactive --tty --env {{variable_name}}={{value}} {{container_name}} {{/bin/bash}}

docker exec --user {{user}} {{container_name}} {{command}}