对于一个运行的容器,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 实际上就是容器的控制台终端 ...
- sqli-libs(2)
Lesson2:数字型注入我们先来测试一下 http://127.0.0.1/sql1/Less-2/?id=1%20and%201=1 发现未报错 这里知道我们的数字型注入是不需要 进行单引号闭合的 ...
- java取小数点后两位
package com.yonyou.sud.algorithm; import java.math.BigDecimal;import java.text.DecimalFormat;/*** ja ...
- python环境下安装virtualenv,virtualenvwrapper
在使用 Python 开发的过程中,工程一多,难免会碰到不同的工程依赖不同版本的库的问题: 亦或者是在开发过程中不想让物理环境里充斥各种各样的库,引发未来的依赖灾难. 此时,我们需要对于不同的工程使用 ...
- Windows下如何安装Redis
Redis可以从下面的github上面下载,当前的下载版本为3.2.100版本 https://github.com/MicrosoftArchive/redis/releases 这边都是64位的链 ...
- kotlin实现流读取
在Java对流的读取是下面的那样,当前不要忘记流的关闭close. // java 代码void someFunc(InputStream in, OutputStream out) throws I ...
- linux 接收udp流花屏的问题
最近服务部署到一个Linux上面,接收udp的广播流花屏,问运维说带宽正常,就琢磨了一下应该的丢包了,程序本身申请的socket缓存还是蛮大的,就看看系统的缓存, 用命令cat /proc/sys/n ...
- 关于 LDTP 操纵 windows 控件。
LDTP doc: https://ldtp.freedesktop.org/user-doc/ 对于 web 自动化,我们用 Selenium, 但是对于 windows 控件,我们可以使用 LD ...
- OSPF协议学习以及路由器配置
OSPF协议学习以及路由器配置 1.实验任务 2,使用eNsp搭建网络拓扑 3.配置路由IP ps:要使用GE(3层口),2层口(E口)需要先配置Vlan才能配置IP地址 4.配置路由器R1的ospf ...
- git使用遇到的问题
1.我新建了一个django项目,然后又在git上新建了一个仓库,然后我在django的项目文件内,将git上的项目clone到这个文件内的时候 git clone https://gitee.com ...
- python3.5 元组
1.创建元祖 tup1 = ('jenkins','mysql') print(tup1) ssh://root@192.168.0.204:22/usr/bin/python -u /home/pr ...