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