Move pages under tldr, lint run.sh, update docs

This commit is contained in:
2024-02-21 13:58:43 +02:00
parent 3d653cc7e6
commit 2c475fa62d
4806 changed files with 36 additions and 35 deletions

33
tldr/docker-exec Normal file
View File

@@ -0,0 +1,33 @@
---
syntax: markdown
tags: [tldr, common]
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/engine/reference/commandline/exec/>.
- Enter an interactive shell session on an already-running container:
`docker exec --interactive --tty {{container_name}} {{/bin/bash}}`
- Run a command in the background (detached) on a running container:
`docker exec --detach {{container_name}} {{command}}`
- Select the working directory for a given command to execute into:
`docker exec --interactive --tty --workdir {{path/to/directory}} {{container_name}} {{command}}`
- Run a command in background on existing container but keep `stdin` open:
`docker exec --interactive --detach {{container_name}} {{command}}`
- Set an environment variable in a running Bash session:
`docker exec --interactive --tty --env {{variable_name}}={{value}} {{container_name}} {{/bin/bash}}`
- Run a command as a specific user:
`docker exec --user {{user}} {{container_name}} {{command}}`