Home ยป Containers ยป Dozzle Real-Time Docker Log Monitoring Made Easy
Containers

Dozzle Real-Time Docker Log Monitoring Made Easy

Learn about Real-Time Docker Log Monitoring with Dozzle. You can easily tail logs from all your Docker containers and Kubernetes pods

One of the struggles that I know I had when starting to implement containers in the home lab a few years back was visibility on what was actually going on in the containers themselves. As you learn how to look at your Docker logs, this gets easier. However, it makes is more easy to keep up with the logging inside them, when you have a tool that is purpose-built for this. Dozzle is a tool that provides an easy way to tail logs from all your running Docker containers. In this post, we’ll learn about Dozzle real-time Docker log viewer and how it can help with DevOps and home lab setups. Also, we’ll see how to deploy it, and other things to note.

What Is Dozzle?

First of all, Dozzle is a self-hosted web-based log viewer for Docker containers. It allows you to see a real-time stream of container logs in a web-based UI. So instead of having to tail logs from the command line, you can use the easy Dozzle interface to view the logs of your containers on your Docker container host, Docker Swarm hosts, or even Kubenetes, which is really cool.

Key features of Dozzle to note:

  • Live tail logs from all running Docker containers
  • Web-based UI
  • No database or heavy configuration needed
  • Very low resource usage
  • Good for home labs, and light production environments
  • A quick view of logs without setting up a full logging stack
  • Real-time output without SSH-ing into every container host

Dozzle is an open-source project and you can see the official repository here: https://github.com/amir20/dozzle, with official documentation and deployment instructions available on dozzle.dev.

Real-time monitoring is the way to go

There may be solutions out there that aggregate historical logs for you on your containerized environments. This definitely has its place. However, when you are troubleshooting or looking at errors, seeing the environment logs in real-time is the most helpful.

Other solutions like the ELK stack (Elasticsearch, Logstash, Kibana) or other platforms can be extremely complicated to setup and even require a lot of resources. These are great solutions as well. However, if you want something extremely simple that can give you visibility of your logs on your Docker or Kubernetes hosts.

This makes Dozzle especially popular for the following use cases and a good fit for:

  • Developers working on local or remote Docker environments
  • Home lab enthusiasts
  • Small teams troubleshooting docker across hosts

Installing Dozzle

The process to install Dozzle is easy and as you guessed it, it runs on Docker. Let’s see how you can get it running using Docker Compose or a Docker command line command.

Docker Run (Quick Start)

docker run -d \
  --name=dozzle \
  -p 8080:8080 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  --restart always \
  amir20/dozzle:latest
Installing dozzle using the docker command line
Installing dozzle using the docker command line

This command does the following:

  • Pulls the latest Dozzle container image
  • Binds it to port 8080
  • Mounts the Docker socket so Dozzle can read logs
  • Sets the container to restart automatically on failure or host reboot

Once running, you can open http://your-docker-host:8080 in a browser to start viewing logs in real time.

Docker Compose Example

If you would rather use Docker Compose to provision Dozzle, this is just as easy. Form up a docker-compose.yml file with the following:

version: "3"

services:
  dozzle:
    image: amir20/dozzle:latest
    container_name: dozzle
    ports:
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    restart: always

To bring up Dozzle with Compose:

docker-compose up -d

Again, you can navigate to port 8080 on your Docker host: http://localhost:8080.

Using Dozzle and the interface

Dozzleโ€™s interface is as minimal as it gets, and thatโ€™s a good thing. Hereโ€™s what youโ€™ll find once you launch the dashboard:

Container List

Dozzle automatically detects all running containers and displays them in a searchable list. You can also filter containers by name using the search box. You can see in the main dashboard of Dozzle that you get a slick table of:

  • Container name
  • Host
  • Status
  • Created
  • Avg. CPU (%)
  • AVG MEM (%)
Viewing the containers using dozzle
Viewing the containers using dozzle

When you click the container name in the table above, you get taken immediately to a real-time view of the logs.

Viewing the logs of a container
Viewing the logs of a container

You also get a powerful search feature that allows you to search across your container hosts for specific containers:

Search functionality in dozzle
Search functionality in dozzle
Viewing the settings in dozzle
Viewing the settings in dozzle

Installing a remote Dozzle agent

One of the cool features of the solution is that you can not only monitor a local docker host, you can also monitor a remote docker host. To do this, you need to install the Dozzle agent on the remote host:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 7007:7007 amir20/dozzle:latest agent
Adding a dozzle agent to a remote docker host
Adding a dozzle agent to a remote docker host

Adding a remote Dozzle agent to Dozzle

Now that we have the remote agent installed, we can add this to our Dozzle server, using the command when bringing up the Dozzle server:

docker run -d -p 8080:8080 amir20/dozzle:latest --remote-agent agent-ip:7007
Adding a remote agent to a dozzle instance
Adding a remote agent to a dozzle instance

As a tip on the official documentation for Dozzle, it is noted that you add multiple remote agents using the environment variable:

DOZZLE_REMOTE_AGENT=agent1:7007,agent2:7007
Dozzle dashboard with multiple docker hosts added
Dozzle dashboard with multiple docker hosts added

Enabling container actions

There is another very handy feature to the solution and that is to enable container actions. This allows you to start, stop , and restart containers from a dropdown menu next to the container stats.

To enable this, you can do this with the –enable actions flag in the command line or DOZZLE_ENABLE_ACTIONS environment variable in compose code:

docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --enable-actions
Enabling actions in dozzle
Enabling actions in dozzle

Dozzle Security and Access Controls

By default, Dozzle has no authentication enabled meaning you can just browse to the UI web interface without any logins required. If you are running this in the home lab, that is probably just fine. However, many may want to set up authentication on their Dozzle instance. You can do this a couple of ways according to the official documentation: using a proxy, and file-based authentication.

Using file-based authentication

Using a users.yml file, you can set a user password and use bcrypt to encrypt the password string.

users:
  # "admin" here is username
  admin:
    email: [email protected]
    name: Admin
    # Generate with docker run run -it --rm amir20/dozzle generate --name Admin --email [email protected] --password secret admin
    password: $2a$11$9ho4vY2LdJ/WBopFcsAS0uORC0x2vuFHQgT/yBqZyzclhHsoaIkzK
    filter:

You make sure this file is mounted to your dozzle container as a bind mount:

volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - dozzle:/data

Setting up Dozzle in Kubernetes

One of the things I really like about the Dozzle solution is that it allows you to not only have visibility into Docker and Swarm, but also into Kubernetes. You can setup Dozzle in Kubernetes like this:

# rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: pod-viewer
---
# clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: pod-viewer-role
rules:
  - apiGroups: [""]
    resources: ["pods", "pods/log", "nodes"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["metrics.k8s.io"]
    resources: ["pods"]
    verbs: ["get", "list"]
---
# clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: pod-viewer-binding
subjects:
  - kind: ServiceAccount
    name: pod-viewer
    namespace: default
roleRef:
  kind: ClusterRole
  name: pod-viewer-role
  apiGroup: rbac.authorization.k8s.io
---
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dozzle
spec:
  selector:
    matchLabels:
      app: dozzle
  template:
    metadata:
      labels:
        app: dozzle
    spec:
      serviceAccountName: pod-viewer
      containers:
        - name: dozzle
          image: amir20/dozzle:latest
          ports:
            - containerPort: 8080
          env:
            - name: DOZZLE_MODE
              value: "k8s"
---
# service.yaml
apiVersion: v1
kind: Service
metadata:
  name: dozzle-service
spec:
  type: ClusterIP
  selector:
    app: dozzle
  ports:
    - port: 8080
      targetPort: 8080
      protocol: TCP
Installing dozzle into kubernetes
Installing dozzle into kubernetes

When to Use Dozzle

Take a look at the short lists below that give you a feel for when to use Dozzle and when you may need something else in addition to Dozzle.

Use Dozzle When:

  • You want a fast, no-fuss Docker log viewer
  • You run a home lab and need simple monitoring
  • You develop with Docker locally and want better visibility
  • You’re deploying lightweight container stacks and want real-time debugging

Use something else if:

  • You need historical log indexing
  • You need multi-node container orchestration logs
  • You need to have structured log analytics and querying
  • Long-term logs are needed

For those use cases, you could still use Dozzle, but also have something like Loki + Promtail or the ELK stack running.

Alternatives to Dozzle

If you want to explore alternatives, here are a few popular ones:

  • Loki + Grafana: Use this for structured log collection and querying
  • Logspout: Simple log router for Docker
  • Stern (for Kubernetes): Tails multiple podsโ€™ logs in real time
  • GoAccess: Real-time log analysis for web servers

Wrapping up

I am totally impressed with Dozzle. It is one of the simplest and easiest container log solutions that I have used before and it is super easy to spin up. If you need to have full visibility over your containers, logs, and even have some basic start, stop, restart actions, Dozzle is amazing. Also, it isn’t limited to Docker standalone hosts as you can monitor Swarm mode, as well as install Dozzle in Kubernetes and have visibility there. A shout out to one of the awesome Skool community members, @dvincent for reminding me to take a look at this one. It shows the benefits of community in each of our learning paths.


Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.