How docker read the container error log? Docker containers may sometimes experience application failures. When troubleshooting, we can check the error logs.
View container application log
1. Enter the following command on the command line to view the stdout/stderr log of the specified container
docker logs |
2. View the last 100 lines of the specified container Log
docker logs --tail=100|
3. Using the console web interface, in addition to obtaining the log information of a single container, you can also obtain the log information of specified applications and service aggregates. After selecting the specified application and service, select the "Log" tab.
Note: If the container log is output in a file, it is recommended to collect the container log through the integration of the container service and the log service.
Enter the docker ps command on the command line to list all running containers in the cluster; docker ps -a can list all containers in the cluster (including non-running containers)
For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.
The above is the detailed content of How to read logs when something goes wrong with docker. For more information, please follow other related articles on the PHP Chinese website!