Skip to content

Commit 47951ff

Browse files
committed
docs: add "--detach-keys" example to docker run reference
This is a copy of the section we have on the "docker attach" reference page. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent c17b0df commit 47951ff

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

  • docs/reference/commandline

docs/reference/commandline/run.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Create and run a new container from an image
3232
| `--cpuset-cpus` | `string` | | CPUs in which to allow execution (0-3, 0,1) |
3333
| `--cpuset-mems` | `string` | | MEMs in which to allow execution (0-3, 0,1) |
3434
| `-d`, `--detach` | | | Run container in background and print container ID |
35-
| `--detach-keys` | `string` | | Override the key sequence for detaching a container |
35+
| [`--detach-keys`](#detach-keys) | `string` | | Override the key sequence for detaching a container |
3636
| [`--device`](#device) | `list` | | Add a host device to the container |
3737
| [`--device-cgroup-rule`](#device-cgroup-rule) | `list` | | Add a rule to the cgroup allowed devices list |
3838
| `--device-read-bps` | `list` | | Limit read rate (bytes per second) from a device |
@@ -569,6 +569,30 @@ retrieve the container's ID once the container has finished running.
569569

570570
See also [the `docker cp` command](cp.md).
571571

572+
### <a name="detach-keys"></a> Override the detach sequence (--detach-keys)
573+
574+
Use the `--detach-keys` option to override the Docker key sequence for detach.
575+
This is useful if the Docker default sequence conflicts with key sequence you
576+
use for other applications. There are two ways to define your own detach key
577+
sequence, as a per-container override or as a configuration property on your
578+
entire configuration.
579+
580+
To override the sequence for an individual container, use the
581+
`--detach-keys="<sequence>"` flag with the `docker attach` command. The format of
582+
the `<sequence>` is either a letter [a-Z], or the `ctrl-` combined with any of
583+
the following:
584+
585+
* `a-z` (a single lowercase alpha character )
586+
* `@` (at sign)
587+
* `[` (left bracket)
588+
* `\\` (two backward slashes)
589+
* `_` (underscore)
590+
* `^` (caret)
591+
592+
These `a`, `ctrl-a`, `X`, or `ctrl-\\` values are all examples of valid key
593+
sequences. To configure a different configuration default key sequence for all
594+
containers, see [**Configuration file** section](cli.md#configuration-files).
595+
572596
### <a name="device"></a> Add host device to container (--device)
573597

574598
```console

0 commit comments

Comments
 (0)