...

/

Managing Logs with Docker Volumes

Managing Logs with Docker Volumes

Learn about Docker volumes and how they can be used to manage and store logs.

So far, we've been using Go's log package to log messages and then Zap to add some structure to the logs. We 've also seen how we can either output the logs to the console or store them in a file. Saving logs to a file is obviously the preferable option in any real-world applications because we could need them later for debugging or analytics. But how does this work in the case of an app that is running inside a Docker container since we know that in such a case, any files created would reside inside the container and wouldn't be accessible from outside? Well, that's not strictly true. Let's see how.

Docker volumes

We've made changes to our app such that the logs get written in the app container. But how can we access ...