Merge pull request #26268 from AkihiroSuda/eventsjsonl
add `docker events --format` Upstream-commit: bb6fe56e8847112e55429309bf3ac004753ae3a8 Component: engine
This commit is contained in:
@ -17,6 +17,7 @@ Get real time events from the server
|
||||
|
||||
Options:
|
||||
-f, --filter value Filter output based on conditions provided (default [])
|
||||
--format string Format the output using the given go template
|
||||
--help Print usage
|
||||
--since string Show all events created since timestamp
|
||||
--until string Stream events until this timestamp
|
||||
@ -85,6 +86,16 @@ The currently supported filters are:
|
||||
* network (`network=<name or id>`)
|
||||
* daemon (`daemon=<name or id>`)
|
||||
|
||||
## Format
|
||||
|
||||
If a format (`--format`) is specified, the given template will be executed
|
||||
instead of the default
|
||||
format. Go's [text/template](http://golang.org/pkg/text/template/) package
|
||||
describes all the details of the format.
|
||||
|
||||
If a format is set to `{{json .}}`, the events are streamed as valid JSON
|
||||
Lines. For information about JSON Lines, please refer to http://jsonlines.org/ .
|
||||
|
||||
## Examples
|
||||
|
||||
You'll need two shells for this example.
|
||||
@ -180,3 +191,22 @@ relative to the current time on the client machine:
|
||||
$ docker events --filter 'type=plugin' (experimental)
|
||||
2016-07-25T17:30:14.825557616Z plugin pull ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/no-remove:latest)
|
||||
2016-07-25T17:30:14.888127370Z plugin enable ec7b87f2ce84330fe076e666f17dfc049d2d7ae0b8190763de94e1f2d105993f (name=tiborvass/no-remove:latest)
|
||||
|
||||
**Format:**
|
||||
|
||||
$ docker events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
|
||||
Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||
Type=container Status=attach ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||
Type=container Status=start ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||
Type=container Status=resize ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||
Type=container Status=die ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||
Type=container Status=destroy ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||
|
||||
**Format (as JSON Lines):**
|
||||
|
||||
$ docker events --format '{{json .}}'
|
||||
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||
{"status":"attach","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||
{"Type":"network","Action":"connect","Actor":{"ID":"1b50a5bf755f6021dfa78e..
|
||||
{"status":"start","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f42..
|
||||
{"status":"resize","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||
|
||||
Reference in New Issue
Block a user