对于一个运行的容器,Docker 会将日志发送到容器的标准输出设备(STDOUT)和标准错误设备(STDERR),STDOUT和STDERR实际上就是容器的控制台终端。
[root@ubuntu ~]# docker run --name web01 -p 80:80 httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Thu May 09 01:04:43.943040 2019] [mpm_event:notice] [pid 1:tid 139694789120064] AH00489: Apache/2.4.39 (Unix) configured -- resuming normal operations
[Thu May 09 01:04:43.943184 2019] [core:notice] [pid 1:tid 139694789120064] AH00094: Command line: 'httpd -D FOREGROUND'
10.12.28.253 - - [09/May/2019:01:04:50 +0000] "GET / HTTP/1.1" 200 45
10.12.28.253 - - [09/May/2019:01:05:05 +0000] "GET /httpd_access_testweb01 HTTP/1.1" 404 220
2、容器放到后台运行,然后使用 docker attach 进入容器查看,但是退出不方便,容器kill掉容器(理论上ctrl+p 、ctrl+q 可以退出,实际上很多时候不好用)
[root@ubuntu ~]# docker run --name web02 -d -p 81:80 httpd
6c86c63d729e776efe49b8a305f0dc8ed8e7261c99c1a3c6c96b288a2fc9e8de
[root@ubuntu ~]# docker attach web02
10.12.28.253 - - [09/May/2019:01:06:42 +0000] "GET /httpd_access_testweb02 HTTP/1.1" 404 220
^P^P^P^P^P^P^Pp^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P
[root@ubuntu ~]# docker run --name web03 -d -p 82:80 httpd
d777fe241f27b541a776e4e0eca4e86754e61d7fe324bb6720e46711707a5a30
[root@ubuntu ~]# docker logs web03
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Thu May 09 01:07:37.761772 2019] [mpm_event:notice] [pid 1:tid 140651667042368] AH00489: Apache/2.4.39 (Unix) configured -- resuming normal operations
[Thu May 09 01:07:37.761911 2019] [core:notice] [pid 1:tid 140651667042368] AH00094: Command line: 'httpd -D FOREGROUND'
10.12.28.253 - - [09/May/2019:01:07:44 +0000] "GET /httpd_access_testweb03 HTTP/1.1" 404 220
[root@ubuntu ~]# docker logs -f web03
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Thu May 09 01:07:37.761772 2019] [mpm_event:notice] [pid 1:tid 140651667042368] AH00489: Apache/2.4.39 (Unix) configured -- resuming normal operations
[Thu May 09 01:07:37.761911 2019] [core:notice] [pid 1:tid 140651667042368] AH00094: Command line: 'httpd -D FOREGROUND'
10.12.28.253 - - [09/May/2019:01:07:44 +0000] "GET /httpd_access_testweb03 HTTP/1.1" 404 220
10.12.28.253 - - [09/May/2019:01:08:09 +0000] "GET /httpd_access_testweb03 HTTP/1.1" 404 220
10.12.28.253 - - [09/May/2019:01:08:09 +0000] "GET /httpd_access_testweb03 HTTP/1.1" 404 220
10.12.28.253 - - [09/May/2019:01:08:11 +0000] "GET /httpd_access_testweb03_01 HTTP/1.1" 404 223
10.12.28.253 - - [09/May/2019:01:08:12 +0000] "GET /httpd_access_testweb03_02 HTTP/1.1" 404 223
10.12.28.253 - - [09/May/2019:01:08:13 +0000] "GET /httpd_access_testweb03_03 HTTP/1.1" 404 223
- 日志管理之 Docker logs - 每天5分钟玩转 Docker 容器技术(87)
高效的监控和日志管理对保持生产系统持续稳定地运行以及排查问题至关重要. 在微服务架构中,由于容器的数量众多以及快速变化的特性使得记录日志和监控变得越来越重要.考虑到容器短暂和不固定的生命周期,当我们需 ...
- [2019.05.09]Linux 学习笔记(3)
最近的心得: CLI真好用,GUI就是渣渣 1. Bash 里面的命令是可以起别名的,起一个别名的方法是 alias [Alias]=[command] command可以是任意长的别名,比如 ali ...
- Docker容器日志管理最佳实践
目录 一 .Docker 引擎日志 二.容器日志 2.1.常用查看日志命令--docker logs 2.2 .Docker 日志 驱动 三. 生产环境中该如何储存容器中的日志 一.当是完全是标准输出 ...
- Docker 日志管理最佳实践
开源Linux 回复"读书",挑选书籍资料~ Docker-CE Server Version: 18.09.6 Storage Driver: overlay2 Kernel V ...
- 你必须知道的容器日志 (1) Docker logs & logging driver
本篇已加入<.NET Core on K8S学习实践系列文章索引>,可以点击查看更多容器化技术相关系列文章.监控和日志历来都是系统稳定运行和问题排查的关键,在微服务架构中,数量众多的容器以 ...
- Docker 容器日志管理
Docker 日志分为两类: Docker 引擎日志(也就是 dockerd 运行时的日志), 容器的日志,容器内的服务产生的日志. 一 .Docker 引擎日志 Docker 引擎日志一般是交给了 ...
- 云计算Docker全面项目实战(Maven+Jenkins、日志管理ELK、WordPress博客镜像)
2013年,云计算领域从此多了一个名词“Docker”.以轻量著称,更好的去解决应用打包和部署.之前我们一直在构建Iaas,但通过Iaas去实现统一功 能还是相当复杂得,并且维护复杂.将特殊性封装到 ...
- Docker安全及日志管理
Docker安全及日志管理 目录 Docker安全及日志管理 一.Docker容器与虚拟机的区别 1. 隔离与共享 2. 性能与损耗 3. 总结 二.Docker存在的安全问题 1. Docker自身 ...
- Docker日志管理--docker部署安装ELK (十一)--技术流ken
Docker logs 对于一个运行的容器,Docker 会将日志发送到 容器的 标准输出设备(STDOUT)和标准错误设备(STDERR),STDOUT 和 STDERR 实际上就是容器的控制台终端 ...
- IDEA的Python工程在inspections时提示:The JDK is not configured properly for this project. Inspection cannot proceed.
原因:IDEA将工程误认为了Java工程. 解决方法:如果确认这是个Python工程,修改*.iml文件,将下面的这一行删除 <orderEntry type="inheritedJd ...
- 记一次elastic-job使用
当当的elastic-job定时任务 业务场景是定时从微信取accesstoken和jsticket,因为都只有7200秒的有效时间,所以设置了定时任务,定时将得到的数据存到redis缓存中 问题1: ...
- python3笔记十五:python函数
一:学习内容 函数概述 函数的参数与返回值 参数值传递和引用传递 关键字参数 默认参数 不定长参数 二:函数概述 1.本质:函数就是对功能的封装 2.优点: 简化代码结构,增加了代码的复用度(重复使用 ...
- oracle取差值集合
Oracle Minus关键字 SQL中的MINUS关键字 SQL中有一个MINUS关键字,它运用在两个SQL语句上,它先找出第一条SQL语句所产生的结果,然后看这些结果有没有在第二个SQL语句的结果 ...
- android 注入框架 DI
android 主要注入框架以及github如下: (1)Roboguice https://github.com/roboguice/roboguice (2)Butterknife https:/ ...
- Android-Universal-Image-Loader的缓存处理机制与使用 LruCache 缓存图片
讲到缓存,平时流水线上的码农一定觉得这是一个高大上的东西.看过网上各种讲缓存原理的文章,总感觉那些文章讲的就是玩具,能用吗?这次我将带你一起看过UIL这个国内外大牛都追捧的图片缓存类库的缓存处理机制. ...
- Java中的23种设计模式与7大原则
一.创建型模式 1.抽象工厂模式(Abstract factory pattern): 提供一个接口, 用于创建相关或依赖对象的家族, 而不需要指定具体类.2.生成器模式(Builder patter ...
- 浏览器端-W3School-HTML:HTML DOM Area 对象
ylbtech-浏览器端-W3School-HTML:HTML DOM Area 对象 1.返回顶部 1. HTML DOM Area 对象 Area 对象 Area 对象代表图像映射的一个区域(图像 ...
- Socket上自定义协议总结
TCP只是一个可靠传输的通信管道,上层协议要你自己定的,通俗来说就是发送方和接收方的约定 自定义协议的核心有两个:1. 控制码2. 流程控制 用Socket进行通信,发送的数据包一定是有结构的,类似于 ...
- consumeQueue 和 indexFile 文件
broker 把消息写入 commitLog 后,还需要把消息的索引写入 consumeQueue 文件 和 indexFile 文件 // org.apache.rocketmq.store.Def ...