Installing Umami Analytics with Docker: A Simple Guide
If you’re like me and want a straightforward, privacy-focused alternative to the heavyweight options like Google Analytics, then Umami is an excellent choice. It’s open-source, lightweight, and doesn’t bog you down with unnecessary complexity. Best of all, you can self-host it using Docker, ensuring you retain full control over your data and your infrastructure. In this article, I’ll walk you through the steps I took to get Umami Analytics up and running using Docker on Ubuntu 20.04.
Why Umami?
Before we dive into the setup process, let’s talk briefly about why I chose Umami. For starters, Umami offers exactly what I need: simple, clean website analytics that respect users’ privacy. There’s no tracking of personal data, which makes it GDPR-friendly right out of the box. Plus, the interface is minimalistic and intuitive, so I can quickly access the stats I care about without wading through cluttered dashboards.
The best part? Umami is open-source, and I can self-host it, ensuring that all the data remains under my control.
Now, let’s jump into the installation.
Setting Up Umami with Docker
Since I’m running Ubuntu 20.04, I decided to use Docker to make the installation process simpler. Docker keeps everything isolated, so I don’t need to worry about complex system dependencies. This is especially useful when running analytics software like Umami that has multiple components (e.g., a backend and a database).
Step 1: Prerequisites
Before you get started, make sure Docker and Docker Compose are installed on your server. If you haven’t installed Docker yet, here’s a quick rundown on how to do it:
Install Docker
First, update your package list and install the prerequisites:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Next, add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to your sources list:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install Docker:
sudo apt update
sudo apt install docker-ce
To verify the installation, run:
sudo docker --version
Install Docker Compose
Docker Compose is a tool that helps manage multi-container Docker applications, which is exactly what we need for Umami. To install Docker Compose, use this command:
sudo apt install docker-compose
With Docker and Docker Compose installed, we’re ready to move on.
Step 2: Clone the Umami Repository
Now that Docker is installed, the next step is to clone the official Umami repository from GitHub. This repository includes all the configuration files you need to spin up Umami in Docker.
Navigate to your preferred directory and clone the repository:
git clone https://github.com/umami-software/umami.git
Then move into the newly created umami
directory:
cd umami
Step 3: Configure Your Environment
Before we start the containers, we need to configure the environment file. Inside the umami
directory, you’ll find an .env.example
file. This file contains environment variables that control the behavior of the Umami application.
Copy this example file to create your own .env
file:
cp .env.example .env
In this file, you’ll configure the database connection string, which is required for Umami. Since we’re using Docker, there’s no need to change much. The default configuration connects to a PostgreSQL database container automatically, which Docker will manage for us.
If you do need to tweak things (like the database password or hostname), you can edit the .env
file with your favorite text editor.
Step 4: Spin Up the Docker Containers
With everything configured, it’s time to start the Docker containers that will run Umami. Docker Compose makes this process super easy. In the umami
directory, simply run the following command:
sudo docker-compose up -d
Docker Compose will read the docker-compose.yml
file included in the repository and pull the necessary Docker images for Umami and PostgreSQL. It will then start the containers and run them in the background (-d
flag).
Step 5: Access Umami
Once the containers are up and running, you can access your Umami instance by navigating to http://your-server-ip:3000
in your web browser. You should see the Umami login page.
By default, the credentials are:
- Username:
admin
- Password:
umami
I recommend changing the default password as soon as you log in to keep your instance secure.
Step 6: Add Your Websites
Once logged in, you can start adding your websites to Umami. Simply click “Add website” in the dashboard, and Umami will provide you with a tracking code to embed in your website’s HTML.
This code is a lightweight JavaScript snippet (similar to Google Analytics), but with the added benefit of respecting user privacy and staying completely under your control.
Wrapping Up
And that’s it! You’ve successfully set up Umami Analytics using Docker. I love this approach because Docker isolates the application from the rest of my system, making it easier to manage and reducing the risk of conflicting dependencies. Plus, Docker Compose simplifies managing all the moving parts — from the database to the app itself.
If you ever need to stop or restart Umami, you can do so with a single command:
sudo docker-compose down # To stop
sudo docker-compose up -d # To start again
This setup has worked perfectly for me, and I’m really happy with how easy it was to install Umami this way. Give it a try, and enjoy the benefits of simple, privacy-focused website analytics that you fully control!