github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/man/docker-events.1.md (about) 1 % DOCKER(1) Docker User Manuals 2 % Docker Community 3 % JUNE 2014 4 # NAME 5 docker-events - Get real time events from the server 6 7 # SYNOPSIS 8 **docker events** 9 [**--help**] 10 [**-f**|**--filter**[=*[]*]] 11 [**--since**[=*SINCE*]] 12 [**--until**[=*UNTIL*]] 13 [**--format**[=*FORMAT*]] 14 15 16 # DESCRIPTION 17 Get event information from the Docker daemon. Information can include historical 18 information and real-time information. 19 20 Docker containers will report the following events: 21 22 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 23 24 Docker images report the following events: 25 26 delete, import, load, pull, push, save, tag, untag 27 28 Docker volumes report the following events: 29 30 create, mount, unmount, destroy 31 32 Docker networks report the following events: 33 34 create, connect, disconnect, destroy 35 36 # OPTIONS 37 **--help** 38 Print usage statement 39 40 **-f**, **--filter**=[] 41 Provide filter values (i.e., 'event=stop') 42 43 **--since**="" 44 Show all events created since timestamp 45 46 **--until**="" 47 Stream events until this timestamp 48 49 **--format**="" 50 Format the output using the given go template 51 52 The `--since` and `--until` parameters can be Unix timestamps, date formatted 53 timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed 54 relative to the client machine's time. If you do not provide the `--since` option, 55 the command returns only new and/or live events. Supported formats for date 56 formatted time stamps include RFC3339Nano, RFC3339, `2006-01-02T15:04:05`, 57 `2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local 58 timezone on the client will be used if you do not provide either a `Z` or a 59 `+-00:00` timezone offset at the end of the timestamp. When providing Unix 60 timestamps enter seconds[.nanoseconds], where seconds is the number of seconds 61 that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap 62 seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a 63 fraction of a second no more than nine digits long. 64 65 # EXAMPLES 66 67 ## Listening for Docker events 68 69 After running docker events a container 786d698004576 is started and stopped 70 (The container name has been shortened in the output below): 71 72 # docker events 73 2015-01-28T20:21:31.000000000-08:00 59211849bc10: (from whenry/testimage:latest) start 74 2015-01-28T20:21:31.000000000-08:00 59211849bc10: (from whenry/testimage:latest) die 75 2015-01-28T20:21:32.000000000-08:00 59211849bc10: (from whenry/testimage:latest) stop 76 77 ## Listening for events since a given date 78 Again the output container IDs have been shortened for the purposes of this document: 79 80 # docker events --since '2015-01-28' 81 2015-01-28T20:25:38.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) create 82 2015-01-28T20:25:38.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start 83 2015-01-28T20:25:39.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) create 84 2015-01-28T20:25:39.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start 85 2015-01-28T20:25:40.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) die 86 2015-01-28T20:25:42.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) stop 87 2015-01-28T20:25:45.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start 88 2015-01-28T20:25:45.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) die 89 2015-01-28T20:25:46.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) stop 90 91 The following example outputs all events that were generated in the last 3 minutes, 92 relative to the current time on the client machine: 93 94 # docker events --since '3m' 95 2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 96 2015-05-12T15:52:12.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 97 2015-05-12T15:53:45.999999999Z07:00 7805c1d35632: (from redis:2.8) die 98 2015-05-12T15:54:03.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 99 100 If you do not provide the --since option, the command returns only new and/or 101 live events. 102 103 ## Format 104 105 If a format (`--format`) is specified, the given template will be executed 106 instead of the default format. Go's **text/template** package describes all the 107 details of the format. 108 109 # docker events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}' 110 Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26 111 Type=container Status=attach ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26 112 Type=container Status=start ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26 113 Type=container Status=resize ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26 114 Type=container Status=die ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26 115 Type=container Status=destroy ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26 116 117 If a format is set to `{{json .}}`, the events are streamed as valid JSON 118 Lines. For information about JSON Lines, please refer to http://jsonlines.org/ . 119 120 # docker events --format '{{json .}}' 121 {"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4.. 122 {"status":"attach","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4.. 123 {"Type":"network","Action":"connect","Actor":{"ID":"1b50a5bf755f6021dfa78e.. 124 {"status":"start","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f42.. 125 {"status":"resize","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4.. 126 127 128 # HISTORY 129 April 2014, Originally compiled by William Henry (whenry at redhat dot com) 130 based on docker.com source material and internal work. 131 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 132 June 2015, updated by Brian Goff <cpuguy83@gmail.com> 133 October 2015, updated by Mike Brown <mikebrow@gmail.com>