Docker and Docker Compose are the most popular methods of installing Uptime Kuma. With Docker, Uptime Kuma runs in a containerized environment. This way you don’t have to worry about any dependencies, everything is in one package. This allows system administrators to easily replicate or redeploy Uptime Kuma within minutes without having to worry about installing any other software and libraries.
Docker Compose saves you from typing multiple commands in order to install and configure Uptime Kuma. It is all done from one single file. This same docker-compose.yml file can be use to make the deployment scaleable and repeatable in different environments. Basic maintenance tasks that are usually painful on traditional installation methods are easier with Docker. For example, to update the Uptime Kuma image, all you have to do is pull the latest image and restart the container that is it!
Contents
Requirements
To be able to Install Uptime Kuma using Docker or Docker Compose you need to make sure these are installed prior to you continuing:
- Docker and Docker Compose
- Linux (Ubuntu is recommended) or Windows Server/Windows 10
If you do not have Docker and Docker Compose already installed, it can be installed with the following commands below:
curl -fsSL https://get.docker.com | sh
sudo apt install docker-compose -y
Install Uptime Kuma with Docker Compose
Once you have installed the above, it is now time to create a directory for Uptime Kuma. You can use the following command to create a directory in “/home”.
mkdir -p ~/uptime-kuma && cd ~/uptime-kuma
Once you have run the above command, it is now time to create a docker-compose.yml file. You can use either Nano or Vim editor, for the purpose of this guide we are using Nano:
nano docker-compose.yml
You can now copy and paste the following contents of the example docker-compose.yml file we have for Uptime Kuma which is optimized for security and performance (Feel free to make changes as needed):
version: "3.8"
services:
uptime-kuma:
image: louislam/uptime-kuma:latest
container_name: uptime-kuma
restart: always
ports:
- "3001:3001" # This maps the container port "3001" to the host port "3001"
volumes:
- /path/to/data:/app/data # Configuring persistent storage
environment:
- TZ=UTC # Set the timezone (change to your preferred local timezone so monitoring times are the same)
- UMASK=0022 # Set your file permissions manually
networks:
- kuma_network # add your own custom network config
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001"]
interval: 30s
retries: 3
start_period: 10s
timeout: 5s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
kuma_network:
driver: bridge
Now save the file and run the following command to start the Uptime Kuma container:
docker-compose up -d
Now you can go to your browser and visit Uptime Kuma:
http://<your-server-ip-here>:3001
Install Uptime Kuma with Docker
If you do not want to use Docker Compose, you can use the following one-liner Docker run command as well to Install Uptime Kuma which is much quicker as no .yml file is required:
docker run -d –restart=always -p 3001:3001 -v uptime-kuma:/app/data –name uptime-kuma louislam/uptime-kuma:1
Now you can go to your browser and visit Uptime Kuma:
http://<your-server-ip-here>:3001
Useful Docker Commands to Manage Uptime Kuma Better
You can use the following command below to check Docker log files for your container:
docker logs -f uptime-kuma
If you are seeing any issues, you can also try a container restart:
docker-compose restart
Top restart an Uptime Kuma Docker container, run the following command:
docker restart uptime-kuma
If you would like to stop and remove the container:
docker stop uptime-kuma && docker rm uptime-kuma
To simply stop Uptime Kuma:
docker-compose down
If you have any persistent data that you would like to be removed run:
docker volume rm uptime-kuma
Note: The above Docker Compose YAML file and Docker run command can also be found on the Uptime Kuma download page.