Skip to content

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Aug 23, 2021

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)

@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2021

Codecov Report

Merging #3265 (a3235c1) into master (d0df532) will increase coverage by 0.11%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #3265      +/-   ##
==========================================
+ Coverage   58.96%   59.07%   +0.11%     
==========================================
  Files         288      297       +9     
  Lines       24419    24373      -46     
==========================================
  Hits        14399    14399              
+ Misses       9148     9102      -46     
  Partials      872      872              

@thaJeztah thaJeztah force-pushed the object_events branch 3 times, most recently from e8fb0a5 to 6da6a63 Compare March 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 <[email protected]>
Sign up for free to 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