github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/docs/reference/commandline/events.md (about) 1 <!--[metadata]> 2 +++ 3 title = "events" 4 description = "The events command description and usage" 5 keywords = ["events, container, report"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # events 12 13 ```markdown 14 Usage: docker events [OPTIONS] 15 16 Get real time events from the server 17 18 Options: 19 -f, --filter value Filter output based on conditions provided (default []) 20 --help Print usage 21 --since string Show all events created since timestamp 22 --until string Stream events until this timestamp 23 ``` 24 25 Docker containers report the following events: 26 27 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 28 29 Docker images report the following events: 30 31 delete, import, load, pull, push, save, tag, untag 32 33 Docker plugins(experimental) report the following events: 34 35 install, enable, disable, remove 36 37 Docker volumes report the following events: 38 39 create, mount, unmount, destroy 40 41 Docker networks report the following events: 42 43 create, connect, disconnect, destroy 44 45 Docker daemon report the following events: 46 47 reload 48 49 The `--since` and `--until` parameters can be Unix timestamps, date formatted 50 timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed 51 relative to the client machine’s time. If you do not provide the `--since` option, 52 the command returns only new and/or live events. Supported formats for date 53 formatted time stamps include RFC3339Nano, RFC3339, `2006-01-02T15:04:05`, 54 `2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local 55 timezone on the client will be used if you do not provide either a `Z` or a 56 `+-00:00` timezone offset at the end of the timestamp. When providing Unix 57 timestamps enter seconds[.nanoseconds], where seconds is the number of seconds 58 that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap 59 seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a 60 fraction of a second no more than nine digits long. 61 62 ## Filtering 63 64 The filtering flag (`-f` or `--filter`) format is of "key=value". If you would 65 like to use multiple filters, pass multiple flags (e.g., 66 `--filter "foo=bar" --filter "bif=baz"`) 67 68 Using the same filter multiple times will be handled as a *OR*; for example 69 `--filter container=588a23dac085 --filter container=a8f7720b8c22` will display 70 events for container 588a23dac085 *OR* container a8f7720b8c22 71 72 Using multiple filters will be handled as a *AND*; for example 73 `--filter container=588a23dac085 --filter event=start` will display events for 74 container container 588a23dac085 *AND* the event type is *start* 75 76 The currently supported filters are: 77 78 * container (`container=<name or id>`) 79 * event (`event=<event action>`) 80 * image (`image=<tag or id>`) 81 * plugin (experimental) (`plugin=<name or id>`) 82 * label (`label=<key>` or `label=<key>=<value>`) 83 * type (`type=<container or image or volume or network or daemon>`) 84 * volume (`volume=<name or id>`) 85 * network (`network=<name or id>`) 86 * daemon (`daemon=<name or id>`) 87 88 ## Examples 89 90 You'll need two shells for this example. 91 92 **Shell 1: Listening for events:** 93 94 $ docker events 95 96 **Shell 2: Start and Stop containers:** 97 98 $ docker start 4386fb97867d 99 $ docker stop 4386fb97867d 100 $ docker stop 7805c1d35632 101 102 **Shell 1: (Again .. now showing events):** 103 104 2015-05-12T11:51:30.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04) 105 2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 106 2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 107 2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8) 108 2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 109 110 **Show events in the past from a specified time:** 111 112 $ docker events --since 1378216169 113 2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 114 2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 115 2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8) 116 2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 117 118 $ docker events --since '2013-09-03' 119 2015-05-12T11:51:30.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04) 120 2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 121 2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 122 2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8) 123 2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 124 125 $ docker events --since '2013-09-03T15:49:29' 126 2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 127 2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 128 2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8) 129 2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 130 131 This example outputs all events that were generated in the last 3 minutes, 132 relative to the current time on the client machine: 133 134 $ docker events --since '3m' 135 2015-05-12T11:51:30.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 136 2015-05-12T15:52:12.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 137 2015-05-12T15:53:45.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8) 138 2015-05-12T15:54:03.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 139 140 **Filter events:** 141 142 $ docker events --filter 'event=stop' 143 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 144 2014-09-03T17:42:14.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 145 146 $ docker events --filter 'image=ubuntu-1:14.04' 147 2014-05-10T17:42:14.999999999Z07:00 container start 4386fb97867d (image=ubuntu-1:14.04) 148 2014-05-10T17:42:14.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 149 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 150 151 $ docker events --filter 'container=7805c1d35632' 152 2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8) 153 2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image= redis:2.8) 154 155 $ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d' 156 2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 157 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 158 2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (image=redis:2.8) 159 2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 160 161 $ docker events --filter 'container=7805c1d35632' --filter 'event=stop' 162 2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 163 164 $ docker events --filter 'container=container_1' --filter 'container=container_2' 165 2014-09-03T15:49:29.999999999Z07:00 container die 4386fb97867d (image=ubuntu-1:14.04) 166 2014-05-10T17:42:14.999999999Z07:00 container stop 4386fb97867d (image=ubuntu-1:14.04) 167 2014-05-10T17:42:14.999999999Z07:00 container die 7805c1d35632 (imager=redis:2.8) 168 2014-09-03T15:49:29.999999999Z07:00 container stop 7805c1d35632 (image=redis:2.8) 169 170 $ docker events --filter 'type=volume' 171 2015-12-23T21:05:28.136212689Z volume create test-event-volume-local (driver=local) 172 2015-12-23T21:05:28.383462717Z volume mount test-event-volume-local (read/write=true, container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, destination=/foo, driver=local, propagation=rprivate) 173 2015-12-23T21:05:28.650314265Z volume unmount test-event-volume-local (container=562fe10671e9273da25eed36cdce26159085ac7ee6707105fd534866340a5025, driver=local) 174 2015-12-23T21:05:28.716218405Z volume destroy test-event-volume-local (driver=local) 175 176 $ docker events --filter 'type=network' 177 2015-12-23T21:38:24.705709133Z network create 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, type=bridge) 178 2015-12-23T21:38:25.119625123Z network connect 8b111217944ba0ba844a65b13efcd57dc494932ee2527577758f939315ba2c5b (name=test-event-network-local, container=b4be644031a3d90b400f88ab3d4bdf4dc23adb250e696b6328b85441abe2c54e, type=bridge) 179 180 $ docker events --filter 'type=plugin' (experimental) 181 2016-07-25T17:30:14.825557616Z plugin pull ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/no-remove:latest) 182 2016-07-25T17:30:14.888127370Z plugin enable ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/no-remove:latest)