Home > Article > Operation and Maintenance > Where is the docker error log?
Docker is an open source application container engine that allows developers to package their applications and dependencies into a container and run it in the environment. In the process of using Docker, you may encounter various problems. In this case, you need to check the Docker logs to troubleshoot the problem. This article will introduce where the Docker error log is.
Docker container is a virtual environment running in the Docker engine, and each container has its own log. Viewing container logs can help us understand how the container is running. The location of the container log depends on the driver type of the container.
If you are using the json-file
driver type, the container logs are stored in the Docker host's /var/lib/docker/containers/<CONTAINER_ID>/<CONTAINER_ID> ;-json.log
file. This file contains log information for all containers, including stdout and stderr.
If you are using the journald
driver type, the container logs are stored in the system log of the Docker host. You can use the journalctl
command to view container log information.
Docker engine is the host that runs Docker containers, and it also has its own logs. Docker engine logs can help us understand the running status of the Docker daemon and the scheduling of containers.
Docker engine logs can be controlled by modifying the log-driver
parameter in the Docker configuration file daemon.json
. If the log-driver
parameter is not specified, Docker engine logs are stored in the /var/log/docker.log
file by default.
Docker Compose is a tool for defining and running multi-container Docker applications. For containers created using Docker Compose, you can view the corresponding log information through the docker-compose logs
command.
docker-compose logs
The command outputs the log information of all containers by default. If you need to view the log information of a specific service, you can use the docker-compose logs <service>
command, where <service>
is the specified service name.
Viewing Docker logs can help us understand the operation of the container and Docker engine. Docker containers, Docker Engine, and Docker Compose all have their own logs, each stored in different locations. When troubleshooting Docker problems, you need to combine various logs to analyze and solve the problem.
The above is the detailed content of Where is the docker error log?. For more information, please follow other related articles on the PHP Chinese website!