[root@docker01 ~]# docker logs --help

Usage:    docker logs [OPTIONS] CONTAINER

Fetch the logs of a container

Options:
--details Show extra details provided to logs
-f, --follow Follow log output/跟踪日志输出
--help Print usage
--since string Show logs since timestamp/显示某个开始时间的所有日志
--tail string Number of lines to show from the end of the logs (default "all")/仅列出最新N条容器日志
-t, --timestamps Show timestamps/显示时间戳
[root@docker03 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2d18062bc24 docker01.lo:/api-gateway@sha256:016f07159faeacadd5fc8719776382caf39f0b8ffeb276ed9bbecb2adfa8ce75 "java -jar /api-ga..." days ago Up days api-gateway..1q9ww6opn8mppbwmozaoadfyx
e6a7d71258a6 docker01.lo:/api-gateway@sha256:68048a64ae47de39e83be73fa0fc1847c42cfe034b084b89b1de19ff029cd9ab "java -jar /api-ga..." days ago Exited () days ago api-gateway..zeqoq5h3jub6lvqqem4t3phby
231b17a107dc docker01.lo:/api-gateway@sha256:68048a64ae47de39e83be73fa0fc1847c42cfe034b084b89b1de19ff029cd9ab "java -jar /api-ga..." days ago Exited () days ago api-gateway..srz8ufj0eq0ble1r2smyfoeht
d49702881b38 docker01.lo:/api-gateway@sha256:86b6401dc4b1f9eb89c8c9e6f0acd6aa29f0f4b9572598d4b50cecf3bbdac2ed "java -jar /api-ga..." days ago Exited () days ago api-gateway..lw48xff6nb2k2e1ijf0oladsf
ec66c83e978c docker01.lo:/api-gateway@sha256:86b6401dc4b1f9eb89c8c9e6f0acd6aa29f0f4b9572598d4b50cecf3bbdac2ed "java -jar /api-ga..." days ago Exited () days ago api-gateway..ftfl0sl3rtj5qyvz3paifo3ty
f6a5091e25ad docker01.lo:/web-service@sha256:188f8365c115fb14c7b3046a58d7437fa0cf057fc558ab6bcb19d4960728a969 "java -jar /web-se..." days ago Up days web-service..vjg9uq3tbey8lkxv6l2jlkkdw
b3af5cc16203 docker01.lo:/web-gateway@sha256:7b841751783370b89dfde757d36ff875b2d1b01a18c4d5a13e80d33c043e7f2c "java -jar /web-ga..." days ago Up days web-gateway..csnp2ccie9rv9ynxdg92part6
531e6607245b docker01.lo:/web-gateway@sha256:7b841751783370b89dfde757d36ff875b2d1b01a18c4d5a13e80d33c043e7f2c "java -jar /web-ga..." days ago Exited () days ago web-gateway..h9f76ung8d4gi5u1mv9pdwy9r
58919d6b304a docker01.lo:/eureka-server@sha256:55922af71b78ce43fc2a9f2f78ab1f6b17f41e162b858937a744876dd3952c77 "java -jar /eureka..." days ago Up days eureka-server..jbhrlk2lsb75xy41n4dcjvsia
[root@docker03 ~]# docker logs -f  --tail= api-gateway..1q9ww6opn8mppbwmozaoadfyx
-- ::47.111 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config, profiles=[dev], label=null, version=null, state=null
-- ::48.354 INFO --- [trap-executor-] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
-- ::47.148 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://10.0.0.6:7001/
-- ::47.211 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config, profiles=[dev], label=null, version=null, state=null
-- ::48.355 INFO --- [trap-executor-] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
-- ::47.252 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://10.0.0.6:7001/
-- ::47.321 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config, profiles=[dev], label=null, version=null, state=null
-- ::48.355 INFO --- [trap-executor-] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
-- ::47.357 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://10.0.0.6:7001/
-- ::47.418 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config, profiles=[dev], label=null, version=null, state=null

查看容器api-gateway.1.1q9ww6opn8mppbwmozaoadfyx从2017年7月10日后的最新10条日志。

[root@docker03 ~]# docker logs -f --since="2017-07-10" --tail= api-gateway..1q9ww6opn8mppbwmozaoadfyx
-- ::48.354 INFO --- [trap-executor-] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
-- ::47.148 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://10.0.0.6:7001/
-- ::47.211 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config, profiles=[dev], label=null, version=null, state=null
-- ::48.355 INFO --- [trap-executor-] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
-- ::47.252 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://10.0.0.6:7001/
-- ::47.321 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config, profiles=[dev], label=null, version=null, state=null
-- ::48.355 INFO --- [trap-executor-] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
-- ::47.357 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://10.0.0.6:7001/
-- ::47.418 INFO --- [nfoReplicator-] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config, profiles=[dev], label=null, version=null, state=null
-- ::48.357 INFO --- [trap-executor-] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration

Docker logs 命令的更多相关文章

  1. 日志管理之 Docker logs - 每天5分钟玩转 Docker 容器技术(87)

    高效的监控和日志管理对保持生产系统持续稳定地运行以及排查问题至关重要. 在微服务架构中,由于容器的数量众多以及快速变化的特性使得记录日志和监控变得越来越重要.考虑到容器短暂和不固定的生命周期,当我们需 ...

  2. centos7下安装docker(18docker日志---docker logs)

    在微服务架构中,由于容器的数量众多以及快速变化的特性使得记录日志和监控变得越来越重要,考虑到容器的短暂和不固定周期,当我们需要排查问题的时候容器可能不在了.因此,一套集中式的日志管理系统是生产环境中不 ...

  3. 附002.Docker常见命令

    # docker --help Usage: docker [OPTIONS] COMMAND [arg...] docker daemon [ --help | ... ] docker [ -h ...

  4. docker logs 查看实时日志

    docker logs -f -t --since="2017-05-31" --tail=10 edu_web_1 --since : 此参数指定了输出日志开始日期,即只输出指定 ...

  5. 容器技术之Docker常用命令说明

    前面我们聊了docker的基本概念.架构.镜像.网络.数据卷,回顾请参考https://www.cnblogs.com/qiuhom-1874/category/1766327.html:今天这篇博客 ...

  6. docker常用命令

    yum install wget -y wget -O etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7 ...

  7. Docker常用命令大全

    1. 查看docker信息(version.info) # 查看docker版本 $docker version # 显示docker系统的信息 $docker info 2. 对image的操作(s ...

  8. [Linux] - Docker 常用命令

    # 运行docker # -it表示前端运行 docker run -it centos /bin/echo haha # 后端运行并映射80端口 docker run -dt -p : --name ...

  9. Docker - Docker基础命令及使用

    Docker Docker - 官网 Docker - Hub GitHub - Docker Docker中文社区 Docker基础命令 Docker 查看帮助信息:docker --help 查看 ...

随机推荐

  1. Npm基本指令(转)

    一些常用的 npm 指令 當你設定好 node.js 的開發環境後, 是時候來把下面這些常用的 npm 指令給摸熟了. 將套件於全域安裝. 全域安裝的套件通常只是為了執行檔而已. $ npm inst ...

  2. 如何将会员名单加入LINE@生活圈?

    如何将会员名单加入LINE@生活圈? 我要如何将会员名单加入LINE@生活圈呢?答案是没有办法利用LINE@生活圈直接加入会员名单,LINE@生活圈是许可式行销,必须由LINE好友主动将LINE@生活 ...

  3. WebSocket、Socket、TCP、HTTP区别

    https://www.cnblogs.com/merray/p/7918977.html

  4. Android系统自带样式(android:theme)

    Theme.Dialog : (图1)Activity显示为对话框模式 Theme.NoTitleBar : (图2)不显示应用程序标题栏 Theme.NoTitleBar.Fullscreen : ...

  5. libevent 入门教程:Echo Server based on libevent(转)

    下面假定已经学习过基本的socket编程(socket, bind, listen, accept, connect, recv, send, close),并且对异步/callback有基本的认识. ...

  6. Linux CentOS6.5上搭建环境遇到的问题

    1.卸载CentOS自带的JDK 查看centos上 安装的jdk:rpm -qa|grep jdk 出现如下: java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86 ...

  7. Linux平台上用C语言实现与MySQL数据库的连接

    安装编译工具 ---- 这将安装gcc/g++/gdb/make 等基本编程工具: sudo apt-get install build-essential 输入命令"sudo apt-ge ...

  8. 正则-input控制输入

    大于0的数字:/^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/  这正则看不太懂,先放着 作者:Kevin Yang 使用正则表达式找出不包含特定字符串 ...

  9. 【docker】 centos7 下 使用docker 安装 LNMP

    一.安装 mysql 1 获取 mysql 镜像 docker pull mysql:5.7 2 创建mysql的镜像,并运行 docker run -d -p : -e MYSQL_ROOT_PAS ...

  10. Delphi 10 Seattle 小票打印控件TQ_Printer

    TQ_Printrer控件,是一个为方便需要控制打印命令而设计的跨平台专用控件,已包含标准ESC/POS打印控制的基本指令在内(这些基本指令已能很好的满足多数项目使用). TQ_Printrer控件让 ...