Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

The Docker events command

The Docker events command

Docker Command ReferenceDocker Command Reference


docker events This command retrieves in real time the events generated by the Docker daemon.

docker events It allows users to monitor various operational events of Docker containers, images, networks, and volumes, such as create, start, stop, delete, and so on.

Syntax

docker events [OPTIONS]

OPTIONS description:

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)

Formatted 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 shows 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 shows events up to 2023-07-22T16:04:05.


Docker Command ReferenceDocker Command Reference