Jump to content

Docker Logs


Go to solution Solved by Bastian,

Recommended Posts

I cannot be the first to ask this question; I have done diligent searches from what I can tell.  This post:  (at bottom) mentions what to do if you need specific container help.  It shows a button that shows the log file, this button doesn't exist anymore (I assume deprecated by the click-->Log option, but this only shows very limited details (like recent to new, etc). How do I find the LENGTHY log file?  Someone mentioned /var/log but I don't think that's for Docker.  I do not run docker.img, instead I run folders as I've had the .img corrupt more than once on me.  I do know the container ID, but I'm lost and running noob here, trying to find logs for a Docker that is quitting error 139 so I can get support from the appropiate forum.   

 

Any help is appreciated!

 

 

 

 

Link to comment
  • Solution

As you already said, /var/log is mostly logging of the host system. There you can find the log of unraid itself (syslog), the log of the docker engine (I presume, docker.log) and the log of various tools running on the host.

 

As stupid as it sounds, there is none. What you see in `docker logs` (or the UI) is what you get. You have to take into consideration that docker is no normalised ecosystem. It us up to each application and image maintainer how much and what they want to log. There are ways to extend the applications logging. For example, most server (Spring, Asp, etc) have different log levels, controlled through environment variables, but that depends very heavy on the exact implementation.

 

So, what to do if a container fails?
Does it fail on creation (unraid will prompt a "command failed" on saving)? You should get a pretty telling exception message from docker with the reason.
Does it exit with a non-zero code after creation? Check the docker logs. If the creator printed something, it should be in there. Otherwise you have to contact the creator (through an application thread here in the forum, github issue, etc) and attach both the docker log and docker run command (as printed by unraid on saving). They wrote the application and might see more than a third-party can.

 

There could be additional resources, like an internal log file, a configuration file created by the application, etc, but that varies from application to application. 

 

I just noticed that the UI only shows the last 100 or so lines. For the full log you can check the actual log file handled by docker. To get the path just run `docker inspect --format='{{.LogPath}}' <container id>`.

 

I hope it helped and could clear up your question somewhat :)

Link to comment
3 minutes ago, Bastian said:

I just noticed that the UI only shows the last 100 or so lines. For the full log you can check the actual log file handled by docker. To get the path just run `docker inspect --format='{{.LogPath}}' <container id>`.

This is what I was noticing, it truncates quickly (understandable since logs can quickly consume image file space, but 100 seems very low imo.  

 

I appreciate your response...

 

3 minutes ago, Bastian said:

I hope it helped and could clear up your question somewhat :)

 

Some.  😋

Link to comment

Just to make sure, the truncate only happens if you open the log in browser. If you open the log through the shell (usually located in /var/lib/docker/containers/), it is the full log, without any truncating. Since the file is located in /var/ it is only stored in memory and doesn't take up any space on the docker image. This also means you loose any log on reboot.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...