1DOCKER(1) JUNE 2014 DOCKER(1)
2
3
4
6 docker-events - Get real time events from the server
7
8
9
11 docker events [--help] [-f|--filter[=[]]] [--since[=SINCE]]
12 [--until[=UNTIL]] [--format[=FORMAT]]
13
14
15
17 Get event information from the Docker daemon. Information can include
18 historical information and real-time information.
19
20
21 Docker containers will report the following events:
22
23
24 attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update
25
26
27
28 Docker images report the following events:
29
30
31 delete, import, load, pull, push, save, tag, untag
32
33
34
35 Docker volumes report the following events:
36
37
38 create, mount, unmount, destroy
39
40
41
42 Docker networks report the following events:
43
44
45 create, connect, disconnect, destroy
46
47
48
49
51 --help
52 Print usage statement
53
54
55 -f, --filter=[]
56 Filter output based on these conditions
57 - container (container=<name or id>)
58 - event (event=<event action>)
59 - image (image=<tag or id>)
60 - plugin (experimental) (plugin=<name or id>)
61 - label (label=<key> or label=<key>=<value>)
62 - type (type=<container or image or volume or network or daemon>)
63 - volume (volume=<name or id>)
64 - network (network=<name or id>)
65 - daemon (daemon=<name or id>)
66
67
68 --since=""
69 Show all events created since timestamp
70
71
72 --until=""
73 Stream events until this timestamp
74
75
76 --format=""
77 Format the output using the given Go template
78
79
80 The --since and --until parameters can be Unix timestamps, date
81 formatted timestamps, or Go duration strings (e.g. 10m, 1h30m) computed
82 relative to the client machine's time. If you do not provide the
83 --since option, the command returns only new and/or live events.
84 Supported formats for date formatted time stamps include RFC3339Nano,
85 RFC3339, 2006-01-02T15:04:05, 2006-01-02T15:04:05.999999999,
86 2006-01-02Z07:00, and 2006-01-02. The local timezone on the client will
87 be used if you do not provide either a Z or a +-00:00 timezone offset
88 at the end of the timestamp. When providing Unix timestamps enter
89 seconds[.nanoseconds], where seconds is the number of seconds that have
90 elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
91 seconds (aka Unix epoch or Unix time), and the optional .nanoseconds
92 field is a fraction of a second no more than nine digits long.
93
94
95
98 After running docker events a container 786d698004576 is started and
99 stopped (The container name has been shortened in the output below):
100
101
102 # docker events
103 2015-01-28T20:21:31.000000000-08:00 59211849bc10: (from whenry/testimage:latest) start
104 2015-01-28T20:21:31.000000000-08:00 59211849bc10: (from whenry/testimage:latest) die
105 2015-01-28T20:21:32.000000000-08:00 59211849bc10: (from whenry/testimage:latest) stop
106
107
108
110 Again the output container IDs have been shortened for the purposes of
111 this document:
112
113
114 # docker events --since '2015-01-28'
115 2015-01-28T20:25:38.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) create
116 2015-01-28T20:25:38.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start
117 2015-01-28T20:25:39.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) create
118 2015-01-28T20:25:39.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start
119 2015-01-28T20:25:40.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) die
120 2015-01-28T20:25:42.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) stop
121 2015-01-28T20:25:45.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start
122 2015-01-28T20:25:45.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) die
123 2015-01-28T20:25:46.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) stop
124
125
126
127 The following example outputs all events that were generated in the
128 last 3 minutes, relative to the current time on the client machine:
129
130
131 # docker events --since '3m'
132 2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die
133 2015-05-12T15:52:12.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop
134 2015-05-12T15:53:45.999999999Z07:00 7805c1d35632: (from redis:2.8) die
135 2015-05-12T15:54:03.999999999Z07:00 7805c1d35632: (from redis:2.8) stop
136
137
138
139 If you do not provide the --since option, the command returns only new
140 and/or live events.
141
142
144 If a format (--format) is specified, the given template will be
145 executed instead of the default format. Go's text/template package
146 describes all the details of the format.
147
148
149 # docker events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
150 Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
151 Type=container Status=attach ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
152 Type=container Status=start ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
153 Type=container Status=resize ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
154 Type=container Status=die ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
155 Type=container Status=destroy ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
156
157
158
159 If a format is set to {{json .}}, the events are streamed as valid JSON
160 Lines. For information about JSON Lines, please refer to
161 ⟨http://jsonlines.org/⟩ .
162
163
164 # docker events --format '{{json .}}'
165 {"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
166 {"status":"attach","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
167 {"Type":"network","Action":"connect","Actor":{"ID":"1b50a5bf755f6021dfa78e..
168 {"status":"start","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f42..
169 {"status":"resize","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
170
171
172
174 $ docker events --filter 'event=stop'
175 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
176 2014-09-03T17:42:14.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
177
178 $ docker events --filter 'image=ubuntu-1:14.04'
179 2014-05-10T17:42:14.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04)
180 2014-05-10T17:42:14.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
181 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
182
183 $ docker events --filter 'container=7805c1d35632'
184 2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
185 2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image= redis:2.8)
186
187 $ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d'
188 2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04)
189 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04)
190 2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8)
191 2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
192
193 $ docker events --filter 'container=7805c1d35632' --filter 'event=stop'
194 2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8)
195
196 $ docker events --filter 'type=volume'
197 2015-12-23T21:05:28.136212689Z volume create test-event-volume-local (driver=local)
198 2015-12-23T21:05:28.383462717Z volume mount test-event-volume-local (read/write=true, container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, destination=/foo, driver=local, propagation=rprivate)
199 2015-12-23T21:05:28.650314265Z volume unmount test-event-volume-local (container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, driver=local)
200 2015-12-23T21:05:28.716218405Z volume destroy test-event-volume-local (driver=local)
201
202 $ docker events --filter 'type=network'
203 2015-12-23T21:38:24.705709133Z network create 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, type=bridge)
204 2015-12-23T21:38:25.119625123Z network connect 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, container=b4be644031a3d90b400f88ab3d4bdf4dc23adb250e696b6328b85441abe2c54e, type=bridge)
205
206 $ docker events --filter 'type=plugin' (experimental)
207 2016-07-25T17:30:14.825557616Z plugin pull ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/sample-volume-plugin:latest)
208 2016-07-25T17:30:14.888127370Z plugin enable ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/sample-volume-plugin:latest)
209
210
211
212
214 April 2014, Originally compiled by William Henry (whenry at redhat dot
215 com) based on docker.com source material and internal work. June 2014,
216 updated by Sven Dowideit ⟨SvenDowideit@home.org.au⟩ June 2015, updated
217 by Brian Goff ⟨cpuguy83@gmail.com⟩ October 2015, updated by Mike Brown
218 ⟨mikebrow@gmail.com⟩
219
220
221
222Docker Community Docker User Manuals DOCKER(1)