Update cheatsheets

This commit is contained in:
ivuorinen
2025-12-20 00:20:53 +00:00
parent 596a37b175
commit 11f02a6e11
615 changed files with 952 additions and 972 deletions

View File

@@ -5,29 +5,8 @@ source: https://github.com/tldr-pages/tldr.git
---
# docker exec
> Execute a command on an already running Docker container.
> More information: <https://docs.docker.com/reference/cli/docker/container/exec/>.
> This command is an alias of `docker container exec`.
- Enter an interactive shell session on an already-running container:
- View documentation for the original command:
`docker exec {{[-it|--interactive --tty]}} {{container_name}} {{/bin/bash}}`
- Run a command in the background (detached) on a running container:
`docker exec {{[-d|--detach]}} {{container_name}} {{command}}`
- Select the working directory for a given command to execute into:
`docker exec {{[-it|--interactive --tty]}} {{[-w|--workdir]}} {{path/to/directory}} {{container_name}} {{command}}`
- Run a command in background on existing container but keep `stdin` open:
`docker exec {{[-i|--interactive]}} {{[-d|--detach]}} {{container_name}} {{command}}`
- Set an environment variable in a running Bash session:
`docker exec {{[-it|--interactive --tty]}} {{[-e|--env]}} {{variable_name}}={{value}} {{container_name}} {{/bin/bash}}`
- Run a command as a specific user:
`docker exec {{[-u|--user]}} {{user}} {{container_name}} {{command}}`
`tldr docker container exec`