Skip to content

WIP: add <object> events subcommands - #3265

Draft
thaJeztah wants to merge 1 commit into
docker:masterfrom
thaJeztah:object_events
Draft

WIP: add <object> events subcommands#3265
thaJeztah wants to merge 1 commit into
docker:masterfrom
thaJeztah:object_events

Conversation

@thaJeztah

@thaJeztahthaJeztah commented Aug 23, 2021

Copy link
Copy Markdown
Member

This adds events subcommand for objects that emit events. The following sub-
commands have been added:

  • docker builder events
  • docker container events
  • docker image events
  • docker network events
  • docker plugin events
  • docker volume events

And if swarm-mode is enabled:

  • docker config events
  • docker node events
  • docker secret events
  • docker service events

For example:

docker container events --help
Usage: docker container events [OPTIONS]
Get real time container events from the server
Options:
-f, --filter filter Filter output based on conditions provided
--format string Format the output using the given Go template
--since string Show all events created since timestamp
--until string Stream events until this timestamp

Which allows for an easier way to get (e.g.) container events:

docker container events
2022-03-09T20:43:00.065147085Z container create 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.069350334Z container attach 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.322140439Z container start 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.329593970Z container resize 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (height=35, image=hello-world, name=relaxed_wozniak, width=204)
2022-03-09T20:43:00.351286568Z container die 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (exitCode=0, image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.419673665Z container destroy 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)

Which is the equivalent of:

docker events --filter type=container
2022-03-09T20:45:27.343518236Z container create 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.346246258Z container attach 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.611698530Z container start 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.631348951Z container die 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (exitCode=0, image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.694625045Z container destroy 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah
thaJeztahforce-pushed the object_events branch 3 times, most recently from e8fb0a5 to 6da6a63CompareMarch 9, 2022 20:52
This adds `events` subcommand for objects that emit events. The following
subcommands have been added:
- `docker builder events`
- `docker container events`
- `docker image events`
- `docker network events`
- `docker plugin events`
- `docker volume events`
And if swarm-mode is enabled:
- `docker config events`
- `docker node events`
- `docker secret events`
- `docker service events`
For example:
docker container events --help
Usage: docker container events [OPTIONS]
Get real time container events from the server
Options:
-f, --filter filter Filter output based on conditions provided
--format string Format the output using the given Go template
--since string Show all events created since timestamp
--until string Stream events until this timestamp
Which allows for an easier way to get (e.g.) container events:
docker container events
2022-03-09T20:43:00.065147085Z container create 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.069350334Z container attach 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.322140439Z container start 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.329593970Z container resize 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (height=35, image=hello-world, name=relaxed_wozniak, width=204)
2022-03-09T20:43:00.351286568Z container die 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (exitCode=0, image=hello-world, name=relaxed_wozniak)
2022-03-09T20:43:00.419673665Z container destroy 9bd0f04d0e5da85e14920e08a17dc1fd50f5350fbe0d54d22765f1ff8389a10d (image=hello-world, name=relaxed_wozniak)
Which is the equivalent of:
docker events --filter type=container
2022-03-09T20:45:27.343518236Z container create 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.346246258Z container attach 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.611698530Z container start 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.631348951Z container die 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (exitCode=0, image=hello-world, name=vibrant_grothendieck)
2022-03-09T20:45:27.694625045Z container destroy 92ada3b7a6498a9ec6df1a4ee5868c4a99419bf3d7f34de880033c485304fe95 (image=hello-world, name=vibrant_grothendieck)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@thaJeztah@codecov-commenter