How to view the log of Docker startup failure?
To view the logs of a failed Docker startup, you can follow the steps below:
- Open the terminal or command prompt.
- Run the following command to check the logs of the docker service:
- Please show me the logs for the docker service using the command “sudo journalctl -u docker.service”
- If you are not using the sudo command to run docker commands, omit the sudo keyword.
- This will display the log output of the Docker service. You can scroll using the up and down arrow keys and exit using the q key.
- If you only want to view the latest few lines of the log, you can use the following command:
- Show the last 50 lines of the journal for the docker service.
- This will display the latest 50 lines of logs for the Docker service.
Additionally, if you are using Docker Desktop (available for Windows and Mac), you can view the logs by following these steps:
- Click on the Docker icon in the taskbar or menu bar.
- Choose “Preferences” (Windows) or “Preferences…” (Mac).
- Under the “General” tab, you can find the “Log” section.
- For Windows users, the log file can be found at %AppData%\Docker\log.txt.
- For Mac users, the log files can be found at /var/log/docker.log.
- Clicking on the “View” button allows you to open the log file in the default text editor and view the startup logs for Docker.