github.com/tompao/docker@v1.9.1/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 Usage: docker events [OPTIONS] 14 15 Get real time events from the server 16 17 -f, --filter=[] Filter output based on conditions provided 18 --help=false Print usage 19 --since="" Show all events created since timestamp 20 --until="" Stream events until this timestamp 21 22 Docker containers will report the following events: 23 24 attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause 25 26 and Docker images will report: 27 28 delete, import, pull, push, tag, untag 29 30 The `--since` and `--until` parameters can be Unix timestamps, RFC3339 31 dates or Go duration strings (e.g. `10m`, `1h30m`) computed relative to 32 client machine’s time. If you do not provide the --since option, the command 33 returns only new and/or live events. 34 35 ## Filtering 36 37 The filtering flag (`-f` or `--filter`) format is of "key=value". If you would 38 like to use multiple filters, pass multiple flags (e.g., 39 `--filter "foo=bar" --filter "bif=baz"`) 40 41 Using the same filter multiple times will be handled as a *OR*; for example 42 `--filter container=588a23dac085 --filter container=a8f7720b8c22` will display 43 events for container 588a23dac085 *OR* container a8f7720b8c22 44 45 Using multiple filters will be handled as a *AND*; for example 46 `--filter container=588a23dac085 --filter event=start` will display events for 47 container container 588a23dac085 *AND* the event type is *start* 48 49 The currently supported filters are: 50 51 * container (`container=<name or id>`) 52 * event (`event=<event type>`) 53 * image (`image=<tag or id>`) 54 * label (`label=<key>` or `label=<key>=<value>`) 55 56 ## Examples 57 58 You'll need two shells for this example. 59 60 **Shell 1: Listening for events:** 61 62 $ docker events 63 64 **Shell 2: Start and Stop containers:** 65 66 $ docker start 4386fb97867d 67 $ docker stop 4386fb97867d 68 $ docker stop 7805c1d35632 69 70 **Shell 1: (Again .. now showing events):** 71 72 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) start 73 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 74 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 75 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) die 76 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 77 78 **Show events in the past from a specified time:** 79 80 $ docker events --since 1378216169 81 2014-03-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 82 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 83 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) die 84 2014-03-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 85 86 $ docker events --since '2013-09-03' 87 2014-09-03T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) start 88 2014-09-03T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 89 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 90 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) die 91 2014-09-03T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 92 93 $ docker events --since '2013-09-03T15:49:29' 94 2014-09-03T15:49:29.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 95 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 96 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) die 97 2014-09-03T15:49:29.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 98 99 This example outputs all events that were generated in the last 3 minutes, 100 relative to the current time on the client machine: 101 102 $ docker events --since '3m' 103 2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 104 2015-05-12T15:52:12.999999999Z07:00 4 4386fb97867d: (from ubuntu-1:14.04) stop 105 2015-05-12T15:53:45.999999999Z07:00 7805c1d35632: (from redis:2.8) die 106 2015-05-12T15:54:03.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 107 108 **Filter events:** 109 110 $ docker events --filter 'event=stop' 111 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 112 2014-09-03T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 113 114 $ docker events --filter 'image=ubuntu-1:14.04' 115 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) start 116 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 117 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 118 119 $ docker events --filter 'container=7805c1d35632' 120 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) die 121 2014-09-03T15:49:29.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 122 123 $ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d' 124 2014-09-03T15:49:29.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 125 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 126 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) die 127 2014-09-03T15:49:29.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 128 129 $ docker events --filter 'container=7805c1d35632' --filter 'event=stop' 130 2014-09-03T15:49:29.999999999Z07:00 7805c1d35632: (from redis:2.8) stop 131 132 $ docker events --filter 'container=container_1' --filter 'container=container_2' 133 2014-09-03T15:49:29.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die 134 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop 135 2014-05-10T17:42:14.999999999Z07:00 7805c1d35632: (from redis:2.8) die 136 2014-09-03T15:49:29.999999999Z07:00 7805c1d35632: (from redis:2.8) stop