docker 日誌相關

2021-10-05 09:59:51 字數 857 閱讀 1478

作用獲取 docker 容器的日誌。

檢視幫助

docker logs --help
$ docker logs [options] container

options:

--details 顯示更多的資訊

-f, --follow 跟蹤實時日誌

--since string 顯示自某個timestamp之後的日誌,或相對時間,如42m(即42分鐘)

--tail string 從日誌末尾顯示多少行日誌, 預設是all

-t, --timestamps 顯示時間戳

--until string 顯示自某個timestamp之前的日誌,或相對時間,如42m(即42分鐘)

使用示例

檢視指定的時間後固定的 100 行日誌

docker日誌 及 docker容器日誌

docker容器的日誌是預設存在本地的 var lib docker containers container id container id json.log 裡。可以用以下命令查log檔案的位置 docker inspect container id grep log 或 docker insp...

docker 檢視docker容器日誌

1 命令格式 docker logs options container options details 顯示更多的資訊 f,follow 跟蹤實時日誌 since string 顯示自某個timestamp之後的日誌,或相對時間,如42m 即42分鐘 tail string 從日誌末尾顯示多少行日...

docker 日誌位置

日誌分兩類,一類是docker 引擎日誌 另一類是容器日誌。docker 引擎日誌 docker 引擎日誌一般是交給了upstart ubuntu 14.04 或者systemd centos 7,ubuntu 16.04 前者一般位於 var log upstart docker.log下,後者一...