Docker logs命令具有什么功能呢?
下文笔者讲述Docker中logs命令的功能简介说明,如下所示
docker logs功能: 获取容器日志信息
docker logs命令语法
docker logs [OPTIONS] CONTAINER OPTIONS说明 -f:跟踪日志输出 --since:显示某个开始时间的所有日志 -t:显示时间戳 --tail:列出最新N条容器日志例: docker logs命令的示例分享
[root@node0 tmp]# docker logs --tail=8 837 /docker-entrypoint.sh: Configuration complete; ready for start up 2023/01/06 09:28:51 [notice] 1#1: using the "epoll" event method 2023/01/06 09:28:51 [notice] 1#1: nginx/1.21.6 2023/01/06 09:28:51 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 2023/01/06 09:28:51 [notice] 1#1: OS: Linux 3.10.0-1160.el7.x86_64 2023/01/06 09:28:51 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 2023/01/06 09:28:51 [notice] 1#1: start worker processes 2023/01/06 09:28:51 [notice] 1#1: start worker process 23 //实时输出日志 [root@node0 tmp]# docker logs -f 837 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。