查看docker容器日志

容器里面的服务运行报错了,要查看容器的日志

要查看 Docker 容器的日志,可以使用 docker logs 命令。以下是一些常见的使用方法:

基本用法

复制代码
docker logs <container_name_or_id>

查看最近的日志

复制代码
docker logs --tail 100 <container_name_or_id>

查看实时日志

复制代码
docker logs --f <container_name_or_id>

查看带有时间戳的日志

如果需要查看带有时间戳的日志,可以使用 -t 选项:

复制代码
docker logs -t <container_name_or_id>
相关推荐
core5125 分钟前
Nginx 实战:如何通过代理转发下载中文文件并保留原文件名
运维·nginx·代理·下载·转发
OliverH-yishuihan13 分钟前
在 Windows 上安装 Linux
linux·运维·windows
zclinux_19 分钟前
【Linux】虚拟化的内存气泡
linux·运维·服务器
松涛和鸣33 分钟前
DAY33 Linux Thread Synchronization and Mutual Exclusion
linux·运维·服务器·前端·数据结构·哈希算法
CCI3441 小时前
Remote ssh无法连接?
运维·ssh
源去_云走1 小时前
自建 Iconfy API 服务:解决国内访问不稳定问题
前端·容器·npm·node.js
技术小李...1 小时前
docker下mysql更改密码后WordPress提示无法连接数据库问题
运维·docker·容器
Focussend智能化营销2 小时前
2026破局:以营销自动化成熟度Macom模型为鞍,驰骋增长新赛道!
运维·自动化
wanhengidc2 小时前
什么是裸金属服务器
运维·服务器·科技·智能手机·云计算
刘某的Cloud2 小时前
shell脚本-read-输入
linux·运维·bash·shell·read