docker events

Command Name: 

docker events

Description:

Get real time events from the server.

This command gives you the last 1000 events of all docker objects like containers, images, plugins, volumns, Networks, Daemons,Services, Nodes, Secretes, Config.

Syntax:

easywhatis$ docker events --help

Usage: docker events [OPTIONS]

Get real time 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
easywhatis$

Example:

Terminal1:

In Terminal 1 run docker events command.

easywhatis$ docker events
2020-04-12T12:43:57.509507156+05:30 image untag sha256:d6b60f8d8167c04f4776920a642382fea99a1c2ccc5f13dc13e8f9a89516f2f2 (name=sha256:d6b60f8d8167c04f4776920a642382fea99a1c2ccc5f13dc13e8f9a89516f2f2)
2020-04-12T12:43:57.510844593+05:30 image delete
sha256:d6b60f8d8167c04f4776920a642382fea99a1c2ccc5f13dc13e8f9a89516f2f2 (name=sha256:d6b60f8d8167c04f4776920a642382fea99a1c2ccc5f13dc13e8f9a89516f2f2)

Terminal 2:

In Terminal 2 delete any one image. In Terminal 1 you will see that event.

easywhatis$ docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
busybox/test        1.1                 d6b60f8d8167        6 days ago          1.22MB
nginx               latest              ed21b7a8aee9        12 days ago         127MB
ubuntu              latest              4e5021d210f6        3 weeks ago         64.2MB
busybox             latest              83aa35aa1c79        4 weeks ago         1.22MB
easywhatis$ docker rmi busybox/test
Error: No such image: busybox/test
easywhatis$ docker rmi d6b60f8d8167
Untagged: busybox/test:1.1
Deleted: sha256:d6b60f8d8167c04f4776920a642382fea99a1c2ccc5f13dc13e8f9a89516f2f2
easywhatis$