1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00

docker*: add option placeholders (#15952)

This commit is contained in:
Managor 2025-03-17 12:09:59 +02:00 committed by GitHub
parent d28af61b0e
commit dd7c9ffcc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 35 additions and 35 deletions

View file

@ -5,24 +5,24 @@
- Enter an interactive shell session on an already-running container:
`docker exec --interactive --tty {{container_name}} {{/bin/bash}}`
`docker exec {{[-it|--interactive --tty]}} {{container_name}} {{/bin/bash}}`
- Run a command in the background (detached) on a running container:
`docker exec --detach {{container_name}} {{command}}`
`docker exec {{[-d|--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}}`
`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 --interactive --detach {{container_name}} {{command}}`
`docker exec {{[-i|--interactive]}} {{[-d|--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}}`
`docker exec {{[-it|--interactive --tty]}} {{[-e|--env]}} {{variable_name}}={{value}} {{container_name}} {{/bin/bash}}`
- Run a command as a specific user:
`docker exec --user {{user}} {{container_name}} {{command}}`
`docker exec {{[-u|--user]}} {{user}} {{container_name}} {{command}}`

View file

@ -9,15 +9,15 @@
- List all Docker images including intermediates:
`docker images --all`
`docker images {{[-a|--all]}}`
- List the output in quiet mode (only numeric IDs):
`docker images --quiet`
`docker images {{[-q|--quiet]}}`
- List all Docker images not used by any container:
`docker images --filter dangling=true`
`docker images {{[-f|--filter]}} dangling=true`
- List images that contain a substring in their name:

View file

@ -9,15 +9,15 @@
- Print logs and follow them:
`docker logs -f {{container_name}}`
`docker logs {{[-f|--follow]}} {{container_name}}`
- Print last 5 lines:
`docker logs {{container_name}} --tail {{5}}`
`docker logs {{container_name}} {{[-n|--tail]}} {{5}}`
- Print logs and append them with timestamps:
`docker logs -t {{container_name}}`
`docker logs {{[-t|--timestamps]}} {{container_name}}`
- Print logs from a certain point in time of container execution (i.e. 23m, 10s, 2013-01-02T13:23:37):

View file

@ -9,28 +9,28 @@
- List all Docker containers (running and stopped):
`docker ps --all`
`docker ps {{[-a|--all]}}`
- Show the latest created container (includes all states):
`docker ps --latest`
`docker ps {{[-l|--latest]}}`
- Filter containers that contain a substring in their name:
`docker ps --filter "name={{name}}"`
`docker ps {{[-f|--filter]}} "name={{name}}"`
- Filter containers that share a given image as an ancestor:
`docker ps --filter "ancestor={{image}}:{{tag}}"`
`docker ps {{[-f|--filter]}} "ancestor={{image}}:{{tag}}"`
- Filter containers by exit status code:
`docker ps --all --filter "exited={{code}}"`
`docker ps {{[-a|--all]}} {{[-f|--filter]}} "exited={{code}}"`
- Filter containers by status (created, running, removing, paused, exited and dead):
`docker ps --filter "status={{status}}"`
`docker ps {{[-f|--filter]}} "status={{status}}"`
- Filter containers that mount a specific volume or have a volume mounted in a specific path:
`docker ps --filter "volume={{path/to/directory}}" --format "table {{.ID}}\t{{.Image}}\t{{.Names}}\t{{.Mounts}}"`
`docker ps {{[-f|--filter]}} "volume={{path/to/directory}}" --format "table {{.ID}}\t{{.Image}}\t{{.Names}}\t{{.Mounts}}"`

View file

@ -9,11 +9,11 @@
- Download a specific Docker image in quiet mode:
`docker pull --quiet {{image}}:{{tag}}`
`docker pull {{[-q|--quiet]}} {{image}}:{{tag}}`
- Download all tags of a specific Docker image:
`docker pull --all-tags {{image}}`
`docker pull {{[-a|--all-tags]}} {{image}}`
- Download a Docker images for a specific platform, e.g. linux/amd64:
@ -21,4 +21,4 @@
- Display help:
`docker pull --help`
`docker pull {{[-h|--help]}}`

View file

@ -9,12 +9,12 @@
- Force remove a container:
`docker rm --force {{container1 container2 ...}}`
`docker rm {{[-f|--force]}} {{container1 container2 ...}}`
- Remove a container and its volumes:
`docker rm --volumes {{container}}`
`docker rm {{[-v|--volumes]}} {{container}}`
- Display help:
`docker rm --help`
`docker rm {{[-h|--help]}}`

View file

@ -9,23 +9,23 @@
- Run command in a new container in background and display its ID:
`docker run --detach {{image}} {{command}}`
`docker run {{[-d|--detach]}} {{image}} {{command}}`
- Run command in a one-off container in interactive mode and pseudo-TTY:
`docker run --rm --interactive --tty {{image}} {{command}}`
`docker run --rm {{[-i|--interactive]}} {{[-t|--tty]}} {{image}} {{command}}`
- Run command in a new container with passed environment variables:
`docker run --env '{{variable}}={{value}}' --env {{variable}} {{image}} {{command}}`
`docker run {{[-e|--env]}} '{{variable}}={{value}}' {{[-e|--env]}} {{variable}} {{image}} {{command}}`
- Run command in a new container with bind mounted volumes:
`docker run --volume {{/path/to/host_path}}:{{/path/to/container_path}} {{image}} {{command}}`
`docker run {{[-v|--volume]}} {{/path/to/host_path}}:{{/path/to/container_path}} {{image}} {{command}}`
- Run command in a new container with published ports:
`docker run --publish {{host_port}}:{{container_port}} {{image}} {{command}}`
`docker run {{[-p|--publish]}} {{host_port}}:{{container_port}} {{image}} {{command}}`
- Run command in a new container overwriting the entrypoint of the image:

View file

@ -13,7 +13,7 @@
- Start a container, attaching `stdout` and `stderr` and forwarding signals:
`docker start --attach {{container}}`
`docker start {{[-a|--attach]}} {{container}}`
- Start one or more containers:

View file

@ -6,7 +6,7 @@
- List all Docker containers (running and stopped):
`docker ps --all`
`docker ps {{[-a|--all]}}`
- Start a container from an image, with a custom name:
@ -24,9 +24,9 @@
`docker images`
- Open an [i]nteractive [t]ty with Bourne shell (`sh`) inside a running container:
- Open an interactive tty with Bourne shell (`sh`) inside a running container:
`docker exec -it {{container_name}} {{sh}}`
`docker exec {{[-it|--interactive --tty]}} {{container_name}} {{sh}}`
- Remove stopped containers:
@ -34,4 +34,4 @@
- Fetch and follow the logs of a container:
`docker logs -f {{container_name}}`
`docker logs {{[-f|--follow]}} {{container_name}}`