How To Easily Set Up Umami With Docker (Step-by-Step)
Do you want to set up Umami for your Website or Web Application with Docker? In this step-by-step guide, we will first look at what Umami is and then how to set it up!
What is Umami?
Umami is a simple and lightweight, open-source analytics software used as an alternative to Google Analytics. One reason why you should consider it over Google Analytics is that it does not track users across websites and is GDPR compliant, as stated on their website here. With that, you also do not need to display annoying cookie notices!
In the following setup, I will show you how to self-host and set up umami with docker!
Docker setup for Umami
Setting up Umami with Docker is pretty simple. You need to create the following two containers:
- umami-db: store all data
- umami: user interface
Umami itself offers a pretty good docker-compose template (here), that I modified a little bit for my needs:
services: umami: container_name: umami image: ghcr.io/umami-software/umami:postgresql-latest ports: - "3000:3000" # use expose if you use my nginx setup (link in conclusion) # expose: # - "3000" environment: DATABASE_URL: postgresql://umami:umami123@umami-db:5432/umami DATABASE_TYPE: postgresql HASH_SALT: <random-string> depends_on: - umami-db restart: always umami-db: container_name: umami-db image: postgres:12-alpine environment: POSTGRES_DB: umami POSTGRES_USER: umami POSTGRES_PASSWORD: umami123 volumes: - ./umami/data:/var/lib/postgresql/data restart: always
After building all containers by running
docker-compose up -d or
docker compose up -d you can access umami under your machine’s IP with the port 3000. For example http://localhost:3000.
Set up a Website for Tracking in Umami
In this section, we will add a new Website for tracking to our newly created Umami instance. For that we first need to log in with the data set in the umami container and then follow these steps:
- Click on “+ Add a website”
- Give it a name and add your domain
- Copy the snippet and add it to the HTML head of your website!
Setting up Umami with Docker for your website is super simple and has a lot of benefits. In case you want to set it up with HTTPS check out my guide on an automated SSL and Reverse-Proxy setup here.
How do you like Umami?
I hope this guide helped you in setting up Umami on your own and if you liked my content consider subscribing to my monthly newsletter.