Docker events 命令

返回上一级

docker events 从服务器获取实时事件

docker events [OPTIONS]
OPTIONS 说明
-f 根据条件过滤事件
--since 从指定的时间戳后显示所有事件
--until 流水时间显示到指定的时间为止

如果指定的时间是到秒级的,需要将时间转成时间戳

如果时间为日期的话,可以直接使用,如 --since="2016-07-01"

范例

列出 Docker 2018 年 5 月 30 日后的所有事件

[root@localhost ~]# docker events --since="1527638400"
2018-05-31T10:44:05.690262168+08:00 container destroy f6a0e149983a29294abd76c141f44e8da59bcbaf1d283be63fca803a486f9582 (image=jcdemo/flaskapp, maintainer=Jeeva S. Chelladhurai, name=festive_keldysh)
2018-05-31T10:44:05.711976798+08:00 container destroy a43d61d10e12802b4f108481cfb4f5008f11d2531d1e4715bd6f9a5dd39e17c1 (image=jcdemo/flaskapp, maintainer=Jeeva S. Chelladhurai, name=priceless_goldstine)
2018-05-31T10:44:05.729889747+08:00 container destroy 8dce90ca6db7ed907bcd976fe3468c76a63a6327d1f4ac6bb113a0d3279758ad (image=ubuntu:17.10, name=practical_mclean)
2018-05-31T10:44:05.746604880+08:00 container destroy 23f628a826340f24921233a1a48d3b3d4eedd23c9a5ee05abdf8f5e21fcf9c03 (image=jcdemo/flaskapp, maintainer=Jeeva S. Chelladhurai, name=peaceful_edison)
2018-05-31T10:44:05.762481944+08:00 container destroy e08201b591cdccd198fa32c4eedbda4a9ca6c81ce2c066e885c592aede52a8a6 (image=ubuntu:17.10, name=hopeful_wing)
2018-05-31T10:44:05.774983702+08:00 container destroy cf38bec0c26f782d416f41594356a2a604aa2a7501d5bbf90f28272e57b3abe4 (image=ubuntu:17.10, name=admiring_wing)
2018-05-31T10:44:05.791981933+08:00 container destroy 74795df6fcb856cdaf84d8222b27960774ba0b0f8d5ce40e8f12c26ac9c35a3a (image=jcdemo/flaskapp, maintainer=Jeeva S. Chelladhurai, name=clever_mahavira)


...

范例 2

列出 docker 镜像为 python:3.6.5 2018 年 5 月 30 日后的所有事件

[root@localhost ~]# docker events -f "image"="python:3.6.5" --since="1527638400"
2018-05-31T12:37:23.626867500+08:00 image pull python:3.6.5 (name=python)
2018-05-31T12:44:51.775588000+08:00 container create 455bba3c41d4daa3aa348a8789bc8285f4bfb5d9213373b8d3aba1eb339513bd (image=python:3.6.5, name=python_365_flask)
2018-05-31T12:44:51.782655000+08:00 container attach 455bba3c41d4daa3aa348a8789bc8285f4bfb5d9213373b8d3aba1eb339513bd (image=python:3.6.5, name=python_365_flask)
2018-05-31T12:44:52.413641300+08:00 container start 455bba3c41d4daa3aa348a8789bc8285f4bfb5d9213373b8d3aba1eb339513bd (image=python:3.6.5, name=python_365_flask)
2018-05-31T12:44:52.418719800+08:00 container resize 455bba3c41d4daa3aa348a8789bc8285f4bfb5d9213373b8d3aba1eb339513bd (height=27, image=python:3.6.5, name=python_365_flask, width=162)
2018-05-31T12:52:28.390329500+08:00 container die 455bba3c41d4daa3aa348a8789bc8285f4bfb5d9213373b8d3aba1eb339513bd (exitCode=0, image=python:3.6.5, name=python_365_flask)
2018-05-31T12:54:37.629775600+08:00 container commit 455bba3c41d4daa3aa348a8789bc8285f4bfb5d9213373b8d3aba1eb339513bd (comment=python 3.6.5 + flask 1.0.2, image=python:3.6.5, imageID=sha256:aaf108c1dbdc75eff9be9d9333c957b94efa096f978f8ff6b48e456eebe5ff2f, imageRef=twle/py365flask102:latest, name=python_365_flask)

...

返回上一级

关于   |   FAQ   |   我们的愿景   |   广告投放   |  博客

  简单教程,简单编程 - IT 入门首选站

Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.