1DOCKER(1) JUNE 2014 DOCKER(1)
2
3
4
6 docker-attach - Attach to a running container
7
8
9
11 docker attach [--detach-keys[=[]]] [--help] [--no-stdin]
12 [--sig-proxy[=true]] CONTAINER
13
14
15
17 The docker attach command allows you to attach to a running container
18 using the container's ID or name, either to view its ongoing output or
19 to control it interactively. You can attach to the same contained
20 process multiple times simultaneously, screen sharing style, or quickly
21 view the progress of your detached process.
22
23
24 To stop a container, use CTRL-c. This key sequence sends SIGKILL to the
25 container. You can detach from the container (and leave it running)
26 using a configurable key sequence. The default sequence is CTRL-p
27 CTRL-q. You configure the key sequence using the --detach-keys option
28 or a configuration file. See config-json(5) for documentation on using
29 a configuration file.
30
31
32 It is forbidden to redirect the standard input of a docker attach
33 command while attaching to a tty-enabled container (i.e.: launched with
34 -t).
35
36
37
39 --detach-keys=""
40 Override the key sequence for detaching a container. Format is a
41 single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @,
42 ^, [, , or _.
43
44
45 --help
46 Print usage statement
47
48
49 --no-stdin=true|false
50 Do not attach STDIN. The default is false.
51
52
53 --sig-proxy=true|false
54 Proxy all received signals to the process (non-TTY mode only).
55 SIGCHLD, SIGKILL, and SIGSTOP are not proxied. The default is true.
56
57
58
60 If you want, you can configure an override the Docker key sequence for
61 detach. This is useful if the Docker default sequence conflicts with
62 key sequence you use for other applications. There are two ways to
63 define your own detach key sequence, as a per-container override or as
64 a configuration property on your entire configuration.
65
66
67 To override the sequence for an individual container, use the
68 --detach-keys="<sequence>" flag with the docker attach command. The
69 format of the <sequence> is either a letter [a-Z], or the ctrl-
70 combined with any of the following:
71
72
73 · a-z (a single lowercase alpha character )
74
75 · @ (at sign)
76
77 · [ (left bracket)
78
79 · \\ (two backward slashes)
80
81 · _ (underscore)
82
83 · ^ (caret)
84
85
86
87 These a, ctrl-a, X, or ctrl-\\ values are all examples of valid key
88 sequences. To configure a different configuration default key sequence
89 for all containers, see docker(1).
90
91
92
95 In this example the top command is run inside a container, from an
96 image called fedora, in detached mode. The ID from the container is
97 passed into the docker attach command:
98
99
100 # ID=$(sudo docker run -d fedora /usr/bin/top -b)
101 # sudo docker attach $ID
102 top - 02:05:52 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
103 Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
104 Cpu(s): 0.1%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
105 Mem: 373572k total, 355560k used, 18012k free, 27872k buffers
106 Swap: 786428k total, 0k used, 786428k free, 221740k cached
107
108 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
109 1 root 20 0 17200 1116 912 R 0 0.3 0:00.03 top
110
111 top - 02:05:55 up 3:05, 0 users, load average: 0.01, 0.02, 0.05
112 Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
113 Cpu(s): 0.0%us, 0.2%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
114 Mem: 373572k total, 355244k used, 18328k free, 27872k buffers
115 Swap: 786428k total, 0k used, 786428k free, 221776k cached
116
117 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
118 1 root 20 0 17208 1144 932 R 0 0.3 0:00.03 top
119
120
121
122
124 April 2014, Originally compiled by William Henry (whenry at redhat dot
125 com) based on docker.com source material and internal work. June 2014,
126 updated by Sven Dowideit ⟨SvenDowideit@home.org.au⟩
127
128
129
130Docker Community Docker User Manuals DOCKER(1)