-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add docker events --format
#26268
add docker events --format
#26268
Conversation
interesting, LGTM |
SGTM |
Moved to code-review |
And LGTM |
@@ -96,6 +100,20 @@ relative to the current time on the client machine: | |||
If you do not provide the --since option, the command returns only new and/or | |||
live events. | |||
|
|||
## Format | |||
|
|||
If the `--format` option is set to `{{json .}}, the events are streamed as valid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A backtick is missing here 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Code LGTM @AkihiroSuda on the documentation side, few small comments (misses) — we might want to also show an example with a field in addition the the |
tmpl, err := makeTemplate(opts.format) | ||
if err != nil { | ||
return cli.StatusError{StatusCode: 64, | ||
Status: "Template parsing error: " + err.Error()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting looks strange here. I think it should be:
return cli.StatusError{
StatusCode: 64,
Status: "Template parsing error: " + err.Error(),
}
and the error should be "Error parsing format: ", since the user is specfying a --format
not --template
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
6af1049
to
380870c
Compare
LGTM |
380870c
to
8eebc1c
Compare
rebased to upstream |
Still code LGTM, moving to doc review and docs LGTM 🐸 |
|
||
**Format:** | ||
|
||
# docker events --format '{{if eq .Type "container"}}Type={{.Type}} Status={{.Status}} ID={{.ID}}{{end}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if we should use an example that doesn't use "Type" in the template's condition (using --filter type=container
is probably more useful to do that?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, updated PR
Signed-off-by: Akihiro Suda <[email protected]>
8eebc1c
to
5af5a1b
Compare
docs LGTM |
add `docker events --format`
- What I did
Add
docker events --format
.Note that
-f
is the short form of the existing--filter
.(similar to
docker ps
)- How I did it
Please refer to the code
- How to verify it
Example: JSON Lines (aka NDJSON, LDJSON, JSON stream, ...)
automated test:
- Description for the changelog
add
docker events --format
- A picture of a cute animal (not mandatory but encouraged)
https://commons.wikimedia.org/wiki/Pygoscelis_adeliae
Signed-off-by: Akihiro Suda [email protected]