docker打印查看日志

Docker / 166人浏览 / 0人评论

docker logs命令,查看容器abcd 300 行日志(docker logs -f --tail=300 abcd)

docker logs命令

命令参数

$ docker logs --help

Usage:  docker logs [OPTIONS] CONTAINER

Fetch the logs of a container

Aliases:
  docker container logs, docker logs

Options:
      --details        Show extra details provided to logs
  -f, --follow         Follow log output
      --since string   Show logs since timestamp (e.g.
                       "2013-01-02T13:23:37Z") or relative (e.g. "42m"
                       for 42 minutes)
  -n, --tail string    Number of lines to show from the end of the logs
                       (default "all")
  -t, --timestamps     Show timestamps
      --until string   Show logs before a timestamp (e.g.
                       "2013-01-02T13:23:37Z") or relative (e.g. "42m"
                       for 42 minutes)

30分钟的日志查看

$ docker logs --since 30m CONTAINER_ID

某时间之后的日志查看

$ docker logs -t --since="2019-11-02T13:23:37" CONTAINER_ID

某时间段日志查看

$ docker logs -t --since="2019-11-02T13:23:37" --until "2019-11-03T12:23:37" CONTAINER_ID

转载注明:

扩展查找

0 条评论

还没有人发表评论

发表评论 取消回复

记住我的信息,方便下次评论
有人回复时邮件通知我