How has the recent turmoil within the OpenAI offices changed your plans to use GPT in a business process or product in 2024?
Increased uncertainty means we are more likely to evaluate alternative AI chatbots and LLMs.
No change in plans, though we will keep an eye on the situation.
With Sam Altman back in charge, we are more likely to go all-in with GPT and LLMs.
What recent turmoil?
Cloud Native Ecosystem / Containers

Install Dozzle, a Simple Log File Viewer for Docker

A tool like Dozzle will go a long way to help ease your Docker container management. Here's how to get Dozzle deployed...
Oct 29th, 2022 6:00am by
Featued image for: Install Dozzle, a Simple Log File Viewer for Docker

Docker is my go-to container deployment tool. I’ve always found it exponentially easier to use than, say, the likes of Kubernetes. Of course, Docker isn’t suited for every deployment. However, when Docker is apropos, it cannot be beaten for simplicity, reliability, and stability. And then you throw in Docker Swarm and you can scale to meet needs.

But one thing that can still be rather challenging, even with the likes of Docker, is troubleshooting. With container deployments (especially full-stack applications), there are a lot of moving parts to go wrong, and, when something does go wrong, figuring out the culprit can be a real pain in the keister.

One of the best tools you have at your disposal for troubleshooting Docker containers is log files. By using log files you’ll gain insight into your deployments that is absolutely invaluable to keeping those containers running reliably and efficiently.

But how do you view Docker container logs? If you’re familiar with the Docker command line, it’s not all that challenging. For example, say you have a container deployed named mymongo (a MongoDB container) and you’re having trouble with the container. You could view the logs with the command:

You could get more details with:

You could also follow the logs, which will keep outputting new information as events occur within the container. For that, the command is:

You could even view log entries before a specific timestamp, such as:

The above output will only list events that happened until 2 hours ago.

Depending on the complexity of the container, you might see a massive amount of output to comb through. And you might have a lot of containers for which you need to view logs. What happens if you have 20+ containers running on a server? Do you remember all the names of those containers? If not, you’ll have to first locate the name of the container with the command:

With the name of the container in hand, you can then view its logs.

That’s far from efficient and, given the fact that you’re working with containers, efficiency is the name of the game. That’s why there are tools like Dozzle, which offer a web-based UI for the viewing of Docker container logs. Trust me when I say a tool like Dozzle will go a long way to help ease your Docker container management.

Let’s see how to get Dozzle deployed and see how easy it makes viewing Docker container logs.

Installing Docker Community Edition

You probably already have Docker up and running (otherwise, why would you bother reading this)? On the off-chance you don’t, let me show you how you can install the Community Edition of Docker on Ubuntu Server 22.04.

The first thing to do is add the official Docker GPG key with:

Next, we’ll add the official Docker repository with the command:

Install the required dependencies:

Update apt with the command:

Install Docker Community Edition with:

Make sure your user is a member of the docker group with the command:

Finally, log out and log back in so the changes take effect.

How to Deploy Dozzle

Right-o. Now it’s time to deploy our web-based log viewer. For that, issue the command:

It shouldn’t take much time at all for the container to deploy. You can verify the deployment with the command:

You should see something like this:

With the container deployed, open a web browser and point it to http://IP:8888 (where IP is the IP address of the hosting server). You should see a simple interface that lists all of the containers you have running (Figure 1).

Figure 1: The Dozzle web-based interface is clean and simple to use.

Figure 1: The Dozzle web-based interface is clean and simple to use.

Click on any one of those running containers to view the log file (Figure 2).

Figure 2: Dozzle showing the logs for the mymongo container.

Figure 2: Dozzle showing the logs for the mymongo container.

One very nice feature of Dozzle is the ability to download your log files for a container. To do that, click the three-dot menu at the top right corner of an open log file and select Download. This will download the file (with the extension .gz) to your local storage. You can then view the file with any text editor.

And that’s all there is to deploying the Dozzle web-based Docker container log viewer. If you have a significant number of containers to troubleshoot, this might well be one of the most efficient and convenient ways of doing so.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Docker.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.