您现在的位置是:热点 >>正文
云计算核心技术Docker教程:Docker 配置日志驱动程序
热点509008人已围观
简介...
Docker 包含多种日志记录机制,可帮助您 从正在运行的容器和服务中获取信息。这些机制称为日志驱动程序。每个 Docker 守护进程都有一个默认的日志驱动程序,每个容器都会使用云计它,除非您将其配置为使用不同的日志驱动程序,或简称为“log-driver”。
默认情况下,Docker 使用json-filelogging driver,它在内部将容器日志缓存为算核 JSON。除了使用 Docker 附带的日志驱动程序,您还可以实现和使用日志驱动程序插件。
配置默认日志驱动
要将 Docker 守护程序配置为默认使用特定的日志驱动程序,请将 的值设置log-心技driver为daemon.json 配置文件中日志驱动程序的名称。有关详细信息,请参阅dockerd参考手册中的“守护程序配置文件”部分 。
默认的日志驱动程序是json-file.术D 以下示例将默认日志记录驱动程序设置为local日志驱动程序:
{
"log-driver": "local"
}
如果日志驱动程序具有可配置的选项,您可以在daemon.json文oc件中将它们设置 为带有键的 JSON 对象log-opts。以下示例在json-file日志记录驱动程序上设置了两个可配置选项:
{
"log-driver": "json-fileke",
"log-opts": {
"max-size": "10m",
"max-file": "3",
"labels": "production_status",
"env":r教 "os,customer"
}
}
重新启动 Docker 以使更改对新创建的容器生效。现有容器不使用新的日志记录配置。
如果未指定日志记录驱动程序,则默认为json-file. 要查找 Dock程:er 守护程序的当前默认日志记录驱动程序,请运行 docker info并搜索Logging Driver. 您可以在 Linux、macOS 或 Windows 上的 PowerShell 上使用以下Do命令:
$ docker info --format '{{.LoggingDriver}}'
json-file
为容器配置日志驱动程序
当您启动一个容器时,您可以ck使用--log-driver标志将其配置为使用不同于 Docker 守护程序默认值的日志记录驱动程序。如果日志驱动程序具有可配置选项,您可以使用一个或多个--log-opt=标志实例来er设置它们。即使容器使用默认日志驱动程序,它也可以使用不同的可配置选项。
以下示例使用none日志驱动程序启动 Alpine 容器。
$ docker run -it --log-driver non 配e alpine ash
要查找正在运行的容器的当前日志记录驱动程序,如果守护程序正在使用json-file日志记录驱动程序,请运行以下docker inspect 命令,用容器名置日称或 ID 替换:
$ docker inspect -f '{{.HostConfig.LogConfig.Type}}'
json-file
Tags:
相关文章
日内瓦什么梗
热点打讨论组是什么意思问题一:扣字打讨论什么意思脑残行为网络牛逼的人现实就窝囊问题二:骂人打讨论组什么意思就是一个讨论组而且名字是骂人?感觉还真的是奇葩问题...NBA饼曼巴是什么梗?拓展资料克林特·卡佩...
【热点】
阅读更多跨石滩、过草地、负重12kg,UC伯克利等研发新型机器人运动算法,实时快速适应变化环境
热点说到腿式机器人,机器之心以前介绍过不少,如能跑、能跳、能跳绳、跨越障碍的 Spot 机器狗,不用摄像头和激光雷达凭感觉「越野」的 ANYmal 机器人、会翻跟斗的 MIT 机器人,等等。 这些腿式机器...
【热点】
阅读更多标签: 尊界S800 喜马拉雅 小米YU7GT 华为
热点Hello,大家早上好,又是元气满满的一天,先来浏览新鲜的早报吧~ 【余承东揭晓尊界超高端豪华系列新作】 华为常务董事、产品投资评审委员会主任、终端 BG 董事长余承东正式揭晓尊界超高端豪华系列新作...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.lyrics.com/lyrics/kkk3谷歌留痕软件【tg:seogoogle987】,JIU
- https://www.riohondo.edu/?action=QUERY&s=谷歌留痕软件【tg:seogoogle987】,i4f
- https://www.remit.co.jp/pt/?action=CHECK&s=谷歌留痕软件【tg:seogoogle987】,vnT
- https://www.miamiopenmri.com/?action=CHECK&s=谷歌留痕软件【tg:seogoogle987】,fGk
- https://www.pearson.com/en-us/search.html?aq=谷歌留痕软件【tg:seogoogle987】,lSV
- https://www.remit.co.jp/zh/?s=谷歌留痕软件【tg:seogoogle987】,3AD
- https://www.sogou.com/web?query=谷歌留痕软件【tg:seogoogle987】,BFX
- https://www.universal-music.co.jp/?ID=1sIcckCTeBS8FjzCshAW9w53s8gr691o&s=谷歌留痕软件【tg:seogoogle987】,umz
- https://www.ushmm.org/search/results.php?q=谷歌留痕软件【tg:seogoogle987】,qW5
- https://www.kelsa.co.uk/catalogsearch/result/index/?T=1686132119291&q=谷歌留痕软件【tg:seogoogle987】,Yrr
- https://www.terramania.nl/catalogsearch/result/index/?q=谷歌留痕软件【tg:seogoogle987】,jTV
- https://www.vfw.org/search-results?q=谷歌留痕软件【tg:seogoogle987】,Ik9
- https://www.madebyoranges.com/nl/search/谷歌留痕软件【tg:seogoogle987】,tyj
- https://www.universal-music.co.jp/search/?q=谷歌留痕软件【tg:seogoogle987】,2Jw
- https://www.lifesciencesweden.se/search?q=谷歌留痕软件【tg:seogoogle987】,rAw
- https://www.l-and-b.jp/?page=1&s=谷歌留痕软件【tg:seogoogle987】,PiJ
- https://www.hanbat.ac.kr/search/front/Search.jsp?qt=谷歌留痕软件【tg:seogoogle987】Je3
- https://www.nuovabai.it/catalogsearch/result/?action=SEARCH&q=谷歌留痕软件【tg:seogoogle987】,1Jh
- https://www.sdcard.org/ja/?s=谷歌留痕软件【tg:seogoogle987】,V4s
- https://www.paulaschoice.hk/zh_hant/catalogsearch/result/?q=谷歌留痕软件【tg:seogoogle987】,2MD
- https://www.lauben.com/en/?action=SEARCH&s=谷歌留痕软件【tg:seogoogle987】,YLk
- https://www.nyif.com/catalogsearch/result/?q=谷歌留痕软件【tg:seogoogle987】,eRE
- https://www.mintos.org/?s=谷歌留痕软件【tg:seogoogle987】,3kB
- https://www.maigoo.com/search/?block=&q=谷歌留痕软件【tg:seogoogle987】,sdP
- https://www.metalmensales.com/?action=QUERY&s=谷歌留痕软件【tg:seogoogle987】,iLZ
- https://www.qwant.com/?q=谷歌留痕软件【tg:seogoogle987】,4jW
- https://www.youtube.com/hashtag/谷歌留痕软件【tg:seogoogle987】,cm3
- https://www.youthforum.org/search-results?cx=4f5236218ab5e8ef9&ie=UTF-8&q=谷歌留痕软件【tg:seogoogle987】,lo2
- https://www.scq.ubc.ca/?page=2&s=谷歌留痕软件【tg:seogoogle987】,W6g
- https://www.teamlab.art/th/?submit=谷歌留痕软件【tg:seogoogle987】,8Eq
- https://www.temu.com/search_result.html?search_key=谷歌留痕软件【tg:seogoogle987】euH
- https://www.londontheatredirect.com/search/谷歌留痕软件【tg:seogoogle987】,4Sl
- https://www.therapeuticassociates.com/?cat=5&s=谷歌留痕软件【tg:seogoogle987】,Uzw
- https://www.synonyms.com/antonyms/谷歌留痕软件【tg:seogoogle987】,t6F
- https://www.sbaad.no/?s=谷歌留痕软件【tg:seogoogle987】,nkl
- https://store.line.me/search/sticker/ja?q=谷歌留痕软件【tg:seogoogle987】mU2
- https://www.solerpalau.com/en-en/catalogsearch/result/?q=谷歌留痕软件【tg:seogoogle987】,kfx
- https://www.realsporting.com/buscador?buscar=谷歌留痕软件【tg:seogoogle987】,gbn
- https://www.zutari.com/search/谷歌留痕软件【tg:seogoogle987】,BjO
- https://www.mexperience.com/?T=1686132112324&s=谷歌留痕软件【tg:seogoogle987】,7PO
- https://www.navymwr.org/search/?query=谷歌留痕软件【tg:seogoogle987】,MqN
- https://xehay.vn/tim-kiem/=谷歌留痕软件【tg:seogoogle987】,YVs
- https://www.remit.co.jp/vi/?s=谷歌留痕软件【tg:seogoogle987】JVq
- https://zhidao.baidu.com/index/?action=QUERY&word=谷歌留痕软件【tg:seogoogle987】,5Ha
- https://www.voices.com/talents/search?keywords=谷歌留痕软件【tg:seogoogle987】,Gw7
- https://www.nextavenue.org/?action=QUERY&s=谷歌留痕软件【tg:seogoogle987】,m8A
- https://www.dba.dk/soeg/?soeg=谷歌留痕软件【tg:seogoogle987】TZL
- https://5gaa.org/?token=6e2l7hjt2i26gzgctgwdrv7v0j6nxorq&s=谷歌留痕软件【tg:seogoogle987】2sa
- https://www.jusoen.com/addreng.asp?p1=谷歌留痕软件【tg:seogoogle987】y55
- https://www.stonerealestate.com.au/?cat=100&s=谷歌留痕软件【tg:seogoogle987】,W1J