Dozzle is a simple, lightweight, and real-time log viewer application. It allows you to monitor docker container logs via a web-based interface. It provides intelligent search functionality to search logs using regex. It allows you to split screen for viewing multiple logs and download it to your local system.
In this post, we will show you how to install Dozzle log viewer on Ubuntu 22.04.
Prerequisites
- A server running Ubuntu 22.04.
- A root password is configured on the server.
Install Docker Engine
First, install all the required dependencies using the following command:
apt install ca-certificates curl gnupg lsb-release -y
Next, add the Docker GPG key and repository with the following command:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
Next, update the repository and install the Docker Engine with the following command:
apt update -y
apt install docker-ce docker-ce-cli containerd.io -y
Once the installation is finished, verify the Docker version with the following command:
docker --version
You should see the following output:
Docker version 20.10.18, build b40c2f6
Launch Dozzle Container
You can download and launch the Dozzle Docker container with the following command:
docker run --name dozzle -d --volume=/var/run/docker.sock:/var/run/docker.sock -p 8888:8080 amir20/dozzle:latest
You will get the following output:
Unable to find image 'amir20/dozzle:latest' locally latest: Pulling from amir20/dozzle d1cdc3d3f75b: Pull complete 9208c7e48f51: Pull complete Digest: sha256:6c60292275a512749e4429ee82acfa473ae64e9692ddaa440110bf8cdcba1b9f Status: Downloaded newer image for amir20/dozzle:latest c23860a90ab760ca3102be73f50404ab61edf1e868078991b4533b5f09d1cd98
You can verify the downloaded image with the following command:
docker images
You will get the following output:
REPOSITORY TAG IMAGE ID CREATED SIZE amir20/dozzle latest 8ecfe772f6ef 3 days ago 10MB
To check the Dozzle container, run the following command:
docker ps
You will get the following output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c23860a90ab7 amir20/dozzle:latest "/dozzle" 47 seconds ago Up 46 seconds 0.0.0.0:8888->8080/tcp, :::8888->8080/tcp dozzle
At this point, the Dozzle container is started and listens on port 8888. You can check it with the following command:
ss -altnp
You should see the following output:
LISTEN 0 4096 0.0.0.0:8888 0.0.0.0:* users:(("docker-proxy",pid=51708,fd=4)) LISTEN 0 4096 [::]:8888 [::]:* users:(("docker-proxy",pid=51714,fd=4))
Access Dozzle Log Viewer
Now, open your web browser and access the Dozzle web interface using the URL http://your-server-ip:8888. You should see the Dozzle web interface on the following screen:
Click on the container in the left pane. You should see the container log in the following screen:
Conclusion
Congratulations! you have successfully installed Dozzle with Docker on Ubuntu 22.04. You can now monitor all your container logs via a web browser. Feel free to ask me if you have any questions.