Docker 中的守护进程日志位置
Docker 守护进程提供有关微服务架构一般情况的基本信息。 遗憾的是,以容器为中心的日志记录技术允许您从您的服务中收集相关数据,但几乎不提供有关 Docker 服务状态的信息。
本文将讨论守护进程事件以及我们通常可以在哪里找到每个操作系统 (OS) 的守护进程日志。
什么是守护进程事件
守护进程事件是关于 Docker 服务当前如何运行的通知。 每个事件显示:
- 当前时间戳
- 日志级别
- 活动详情
守护进程的事件日志包括以下方面的具体信息:
- 初始化过程中执行的操作
- 主机内核提供的功能
- 发送到容器的命令的状态
- Docker服务的整体状态
- 活动容器的状态
守护进程事件经常提供有关容器状态的详细信息。 例如,守护程序日志可能如下所示:
time="2022-09-18T11:28:40.726969388-05:00" level=info msg="POST /v1.3/container/sample/stop?t=10"
以下部分将讨论在每个操作系统中查找守护程序日志。
Docker 中的守护进程日志位置
我们也许能够使用守护进程日志来识别问题。 根据操作系统设置和使用的日志子系统,Docker 可以将日志保存在以下几个位置之一:
操作系统 | 位置 |
---|---|
Linux | 使用命令 journalctl -xu docker.service(或读取 /var/log/messages 或 /var/log/syslog,具体取决于您的 Linux 发行版) |
macOS 守护进程 dockerd 日志 | ~/Library/Containers/com.docker.docker/Data/log/vm/dockerd.log |
macOS 守护进程 containerd 日志) | ~/Library/Containers/com.docker.docker/Data/log/vm/containerd.log |
Windows WSL2 守护程序 dockerd 日志 | %APPDATA%\Docker\log\vm\dockerd.log |
Windows WSL2 守护进程 containerd 日志 | %APPDATA%\Docker\log\vm\containerd.log |
通用 Windows 容器 | Windows 事件日志(通过事件查看器) |
相关文章
Get the IP address of the Docker container from the host using docker inspect
发布时间:2025/03/26 浏览次数:102 分类:Docker
-
Docker containers are not just for isolation—they are often used to manage processes that still need to communicate directly with each other. However, to communicate, you usually need to know the IP address of each container, which you ca
Solution to incorrect access log time when deploying Nginx in Docker
发布时间:2025/03/26 浏览次数:165 分类:Docker
-
In the process of operating the website, I never took the logs too seriously. Although logging was turned on, I never analyzed the logs carefully. Today, when I looked at the logs on a whim, I found that the recorded time was 8 hours less t
Docker deploys nginx php application
发布时间:2025/03/26 浏览次数:131 分类:Docker
-
I'm learning docker recently. I'm learning by building an nginx+php development environment example. Here I record the build process. First, give a docker-compose.yml deployment configuration file version: '3' services: nginx: container_nam
How to use Docker to image a Node.js web application
发布时间:2025/03/26 浏览次数:107 分类:Docker
-
Docker is a containerization platform that simplifies the packaging and execution of applications. Containers run as independent processes with their own file systems, but share the kernel of their host machine. Docker has attracted much at
Start a Bash terminal in a new Docker container
发布时间:2025/03/26 浏览次数:97 分类:Docker
-
Docker containers are a standard unit for packaging all the dependencies of an application, allowing us to easily run them in any environment. Containers have become very popular recently, and most developers now rely heavily on containers
Passing environment variables to containers in Docker
发布时间:2025/03/26 浏览次数:124 分类:Docker
-
This article will introduce how to pass environment variables to containers in Docker. Passing environment variables to containers in Docker using the -e and tags -env We will first see how to create environment variables and pass them to t
Install Docker using Homebrew
发布时间:2025/03/26 浏览次数:202 分类:Docker
-
There is no doubt that Docker containers have revolutionized the way we develop and deploy applications. They provide developers with the ability to package applications and dependencies in an isolated environment. Recently, we've seen wide
Enforce clean build of images in Docker
发布时间:2025/03/26 浏览次数:87 分类:Docker
-
This article discusses and demonstrates how to enforce clean builds of images in Docker. Building images in Docker We will use a simple Flask application to demonstrate this concept. my-app Create a app.py simple application named in the ho
Running a Docker instance from a Dockerfile
发布时间:2025/03/26 浏览次数:140 分类:Docker
-
Docker containers have undoubtedly become the standard unit for managing software and dependencies in different environments. When using real applications, you must create a docker file before building the container image of the application