Docker Commands Tutorial – docker events

Spread the Knowledge

Docker Events Types?

Docker containers will report the following events:
attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update

Docker images report the following events:
delete, import, load, pull, push, save, tag, untag

Docker volumes report the following events:
create, mount, unmount, destroy

Docker networks report the following events:
create, connect, disconnect, destroy

Docker plugins report the following events:
enable, disable, install, remove

Docker daemons report the following events:
reload

Docker services report the following events:
create, remove, update

Docker nodes report the following events:
create, remove, update

Docker secrets report the following events:
create, remove, update

Docker configs report the following events:
create, remove, update

Docker events commands example

Listening for Docker events

$ docker events

Listening for events since a given date

$ docker events --since '2015-01-28'
$ docker events --since '3m'

Listening for Docker events based on filter

$ docker events --filter 'type=container' --format 'Type={{.Type}}  Status={{.Status}}  ID={{.ID}}'
$ docker events --filter 'event=stop'
$ docker events --filter 'image=ubuntu-1:14.04'
$ docker events --filter 'container=7805c1d35632'
$ docker events --filter 'container=7805c1d35632' --filter 'container=4386fb97867d'
$ docker events --filter 'container=7805c1d35632' --filter 'event=stop'
$ docker events --filter 'type=volume'
$ docker events --filter 'type=network'
$ docker events --filter 'type=plugin' (experimental)

Listening for Docker events based on format

$ docker events --format '{{json .}}'
Rajesh Kumar
Latest posts by Rajesh Kumar (see all)