对于一个运行的容器,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 实际上就是容器的控制台终端 ...
- 四图3d旋转轮播
<!DOCTYPE html><html><head><meta charset="utf-8" /><title>3d ...
- Spring-data-redis 第一天
1.Redis 这就不必哆嗦了,Redis 支持丰富的数据类型,String ,List,Sets ,Sorted Sets,Hashes,这就可以看出Java 操作Redis就要针对各种类型都有自己 ...
- 两种建立堆的方法HeapInsert & Heapify
参考 堆排序中两种建堆方法的比较 第一种方法HeapInsert 它可以假定我们事先不知道有多少个元素,通过不断往堆里面插入元素进行调整来构建堆. 它的大致步骤如下: 首先增加堆的长度,在最末尾的地方 ...
- Java 8 - Stream Collectors分组的例子
1.分组依据,计数和排序 1.1按a分组List并显示它的总数. package com.mkyong.java8; import java.util.Arrays; import java.util ...
- MySort(选做)的实现
MySort(选做)的实现 题目内容 注意:研究sort的其他功能,要能改的动代码,需要答辩 模拟实现Linux下Sort -t : -k 2的功能. 要有伪代码,产品代码,测试代码(注意测试用例的设 ...
- shell脚本之awk、sed、grep案例
1.BEGIN END用法user DIR,内容显示用户名称.用户家目录 $NF为awk的内置变量,表示最后一行,$(NF-1)就表示倒数第二行,最后打印页脚 页眉显示 cat /e ...
- html实现高亮检索
实现效果如下: demo.html <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...
- Uep的保存操作
wzStoreInfoDefineService.update(neWzStoreInfo,updateList,insertList,deleteListpublic void update(WzS ...
- 关于eclipse安装插件的问题
使用eclipse(luna)不行,其为安装了ee有关插件的 使用eclipse(Juno)可以,其为原生版本
- 浏览器端-W3School-HTML:HTML DOM Meta 对象
ylbtech-浏览器端-W3School-HTML:HTML DOM Meta 对象 1.返回顶部 1. HTML DOM Meta 对象 Meta 对象 Meta 对象代表 HTML 的 一个 & ...