2014-04-16 14:07:55 -04:00
|
|
|
% DOCKER(1) Docker User Manuals
|
2014-06-30 22:58:04 -04:00
|
|
|
% Docker Community
|
|
|
|
% JUNE 2014
|
2014-04-16 14:07:55 -04:00
|
|
|
# NAME
|
|
|
|
docker-events - Get real time events from the server
|
|
|
|
|
2014-06-30 22:58:04 -04:00
|
|
|
# SYNOPSIS
|
|
|
|
**docker events**
|
2014-10-15 17:14:12 -04:00
|
|
|
[**--help**]
|
2015-01-06 23:23:32 -05:00
|
|
|
[**-f**|**--filter**[=*[]*]]
|
2014-06-30 22:58:04 -04:00
|
|
|
[**--since**[=*SINCE*]]
|
|
|
|
[**--until**[=*UNTIL*]]
|
2016-09-02 03:40:06 -04:00
|
|
|
[**--format**[=*FORMAT*]]
|
2014-06-30 22:58:04 -04:00
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
Get event information from the Docker daemon. Information can include historical
|
|
|
|
information and real-time information.
|
|
|
|
|
2014-09-25 21:55:36 -04:00
|
|
|
Docker containers will report the following events:
|
|
|
|
|
2016-06-03 13:11:52 -04:00
|
|
|
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
|
2014-09-25 21:55:36 -04:00
|
|
|
|
2016-04-19 00:45:59 -04:00
|
|
|
Docker images report the following events:
|
2014-09-25 21:55:36 -04:00
|
|
|
|
2016-04-19 00:45:59 -04:00
|
|
|
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
|
2014-09-25 21:55:36 -04:00
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
# OPTIONS
|
2014-10-15 17:14:12 -04:00
|
|
|
**--help**
|
|
|
|
Print usage statement
|
|
|
|
|
2015-01-06 23:23:32 -05:00
|
|
|
**-f**, **--filter**=[]
|
|
|
|
Provide filter values (i.e., 'event=stop')
|
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
**--since**=""
|
2014-06-30 22:58:04 -04:00
|
|
|
Show all events created since timestamp
|
|
|
|
|
|
|
|
**--until**=""
|
|
|
|
Stream events until this timestamp
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2016-09-02 03:40:06 -04:00
|
|
|
**--format**=""
|
2016-10-18 06:50:11 -04:00
|
|
|
Format the output using the given Go template
|
2016-09-02 03:40:06 -04:00
|
|
|
|
2015-12-13 11:00:39 -05:00
|
|
|
The `--since` and `--until` parameters can be Unix timestamps, date formatted
|
2015-10-29 13:51:36 -04:00
|
|
|
timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed
|
2016-05-20 14:15:57 -04:00
|
|
|
relative to the client machine's time. If you do not provide the `--since` option,
|
2015-10-29 13:51:36 -04:00
|
|
|
the command returns only new and/or live events. Supported formats for date
|
2015-12-13 11:00:39 -05:00
|
|
|
formatted time stamps include RFC3339Nano, RFC3339, `2006-01-02T15:04:05`,
|
2015-10-29 13:51:36 -04:00
|
|
|
`2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
|
|
|
|
timezone on the client will be used if you do not provide either a `Z` or a
|
|
|
|
`+-00:00` timezone offset at the end of the timestamp. When providing Unix
|
|
|
|
timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
|
|
|
|
that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
|
|
|
|
seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
|
|
|
|
fraction of a second no more than nine digits long.
|
2015-12-13 11:00:39 -05:00
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
# EXAMPLES
|
|
|
|
|
|
|
|
## Listening for Docker events
|
|
|
|
|
2014-04-17 11:36:58 -04:00
|
|
|
After running docker events a container 786d698004576 is started and stopped
|
2014-06-14 03:49:51 -04:00
|
|
|
(The container name has been shortened in the output below):
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# docker events
|
2015-01-28 23:53:53 -05:00
|
|
|
2015-01-28T20:21:31.000000000-08:00 59211849bc10: (from whenry/testimage:latest) start
|
|
|
|
2015-01-28T20:21:31.000000000-08:00 59211849bc10: (from whenry/testimage:latest) die
|
|
|
|
2015-01-28T20:21:32.000000000-08:00 59211849bc10: (from whenry/testimage:latest) stop
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
## Listening for events since a given date
|
|
|
|
Again the output container IDs have been shortened for the purposes of this document:
|
|
|
|
|
2015-01-28 23:53:53 -05:00
|
|
|
# docker events --since '2015-01-28'
|
|
|
|
2015-01-28T20:25:38.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) create
|
|
|
|
2015-01-28T20:25:38.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start
|
|
|
|
2015-01-28T20:25:39.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) create
|
|
|
|
2015-01-28T20:25:39.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start
|
|
|
|
2015-01-28T20:25:40.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) die
|
|
|
|
2015-01-28T20:25:42.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) stop
|
|
|
|
2015-01-28T20:25:45.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) start
|
|
|
|
2015-01-28T20:25:45.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) die
|
|
|
|
2015-01-28T20:25:46.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) stop
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-05-12 15:59:34 -04:00
|
|
|
The following example outputs all events that were generated in the last 3 minutes,
|
|
|
|
relative to the current time on the client machine:
|
|
|
|
|
|
|
|
# docker events --since '3m'
|
2015-10-29 13:51:36 -04:00
|
|
|
2015-05-12T11:51:30.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) die
|
|
|
|
2015-05-12T15:52:12.999999999Z07:00 4386fb97867d: (from ubuntu-1:14.04) stop
|
2015-05-12 15:59:34 -04:00
|
|
|
2015-05-12T15:53:45.999999999Z07:00 7805c1d35632: (from redis:2.8) die
|
|
|
|
2015-05-12T15:54:03.999999999Z07:00 7805c1d35632: (from redis:2.8) stop
|
|
|
|
|
2015-06-04 22:47:46 -04:00
|
|
|
If you do not provide the --since option, the command returns only new and/or
|
|
|
|
live events.
|
|
|
|
|
2016-09-02 03:40:06 -04:00
|
|
|
## Format
|
|
|
|
|
|
|
|
If a format (`--format`) is specified, the given template will be executed
|
|
|
|
instead of the default format. Go's **text/template** package describes all the
|
|
|
|
details of the format.
|
|
|
|
|
|
|
|
# docker events --filter 'type=container' --format 'Type={{.Type}} Status={{.Status}} ID={{.ID}}'
|
|
|
|
Type=container Status=create ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
|
|
|
Type=container Status=attach ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
|
|
|
Type=container Status=start ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
|
|
|
Type=container Status=resize ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
|
|
|
Type=container Status=die ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
|
|
|
Type=container Status=destroy ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
|
|
|
|
|
|
|
If a format is set to `{{json .}}`, the events are streamed as valid JSON
|
|
|
|
Lines. For information about JSON Lines, please refer to http://jsonlines.org/ .
|
|
|
|
|
|
|
|
# docker events --format '{{json .}}'
|
|
|
|
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
|
|
|
{"status":"attach","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
|
|
|
{"Type":"network","Action":"connect","Actor":{"ID":"1b50a5bf755f6021dfa78e..
|
|
|
|
{"status":"start","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f42..
|
|
|
|
{"status":"resize","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
|
|
|
|
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
# HISTORY
|
|
|
|
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
2014-07-01 20:30:25 -04:00
|
|
|
based on docker.com source material and internal work.
|
2014-06-30 22:58:04 -04:00
|
|
|
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2015-06-04 22:47:46 -04:00
|
|
|
June 2015, updated by Brian Goff <cpuguy83@gmail.com>
|
2015-10-29 13:51:36 -04:00
|
|
|
October 2015, updated by Mike Brown <mikebrow@gmail.com>
|