Docker events command

Docker command reference


docker eventsThe command is used to retrieve events generated by the Docker daemon in real time.

docker eventsThe command allows users to monitor various operational events of Docker containers, images, networks, and volumes, such as create, start, stop, delete, etc.

Syntax

docker events [OPTIONS]

OPTIONS description:

  • -f, --filterFilter output based on the provided conditions.
  • --format: Use Go templates to format output.
  • --since: Display events starting from a specified time.
  • --untilShow events up to the specified time.

Example

Get all events:

docker events

Output:

2023-07-22T15:04:05.123456789Z container create 123abc456def (image=ubuntu, name=my_container)
2023-07-22T15:04:06.123456789Z container start 123abc456def (image=ubuntu, name=my_container)
2023-07-22T15:04:10.123456789Z container stop 123abc456def (image=ubuntu, name=my_container)
2023-07-22T15:04:11.123456789Z container destroy 123abc456def (image=ubuntu, name=my_container)

Filter events:

docker events --filter event=stop

The above command only shows container stop events.

Output:

2023-07-22T15:04:10.123456789Z container stop 123abc456def (image=ubuntu, name=my_container)

Format output:

docker events --format '{{.Time}} - {{.Type}} - {{.Action}}'

The above command displays events using the specified format.

Output:

2023-07-22T15:04:05.123456789Z - container - create
2023-07-22T15:04:06.123456789Z - container - start
2023-07-22T15:04:10.123456789Z - container - stop
2023-07-22T15:04:11.123456789Z - container - destroy

Show events starting from the specified time:

docker events --since "2023-07-22T15:04:05"

The above command displays events starting from 2023-07-22T15:04:05.

Show events up to the specified time:

docker events --until "2023-07-22T16:04:05"

The above command displays events up to 2023-07-22T16:04:05.


Docker command reference

other extensions