Last Updated:

Other methods to deploy an Uptime Kuma Docker container

Tech Fossa
Tech Fossa How-to

Table of Contents

There are more ways to deploy a Docker container. In previous posts we used just the command line interface to deploy Uptime Kuma and Portainer. Now let's take a look at some other methods.

Docker Compose

In the previous post this was the command to download and deploy the Uptime Kuma container:

sudo docker run -d --restart=unless-stopped -p 3001:3001 -v /data/dockerdata/uptimekuma/data:/app/data --name uptime-kuma louislam/uptime-kuma:1

Using Docker Compose we are going to split up the command to download the image and deploy the container and the configuration of the Uptime Kuma container in a text file.

The YAML file

Let's create the text file for the configuration, this will be in the YAML format.

sudo nano /data/dockerdata/uptimekuma/uptime-kuma.yaml

Now enter de content below in the file and save it.

services:
  uptime-kuma:
    container_name: uptime-kuma
    image: louislam/uptime-kuma:1
    ports:
      - "3001:3001"
    volumes:
      - /data/dockerdata/uptimekuma/data:/app/data
    restart: unless-stopped
Check container status and stop and delete when needed

First we need to check if the Uptime Kuma container is running. If it is still running we need to stop it first.

sudo docker container ls

πŸ‘‡ Example output πŸ‘‡

techfossa@techfossa-demo-01:/$ sudo docker container ls
CONTAINER ID   IMAGE                           COMMAND                  CREATED        STATUS                  PORTS                                                                                            NAMES
16e87c5044e1   louislam/uptime-kuma:1          "/usr/bin/dumb-init …"   35 hours ago   Up 35 hours (healthy)   0.0.0.0:3001->3001/tcp, :::3001->3001/tcp                                                        uptime-kuma
730e9777e166   portainer/portainer-ce:latest   "/portainer"             11 days ago    Up 35 hours             0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer
techfossa@techfossa-demo-01:/$

The Uptime Kuma container is up and running, let's stop it now.

sudo docker container stop uptime-kuma

πŸ‘‡ Example output πŸ‘‡

techfossa@techfossa-demo-01:/$ sudo docker container stop uptime-kuma
uptime-kuma
techfossa@techfossa-demo-01:/$

We can now check again if the Uptime Kuma container is running or not:

sudo docker container ls

πŸ‘‡ Example output πŸ‘‡

techfossa@techfossa-demo-01:/$ sudo docker container ls
CONTAINER ID   IMAGE                           COMMAND        CREATED       STATUS        PORTS                                                                                            NAMES
730e9777e166   portainer/portainer-ce:latest   "/portainer"   12 days ago   Up 35 hours   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer
techfossa@techfossa-demo-01:/$

The Uptime Kuma container is not running anymoreπŸ‘.
Now remove the container.

sudo docker container remove uptime-kuma

πŸ‘‡ Example output πŸ‘‡

techfossa@techfossa-demo-01:/$ sudo docker container remove uptime-kuma
uptime-kuma
techfossa@techfossa-demo-01:/$
Deploy the container using Docker Compose and the YAML file

Now let's deploy it using docker compose and the YAML file we created.

docker-compose -d -f /data/dockerdata/uptimekuma/uptime-kuma.yaml up

πŸ‘‡ Example output πŸ‘‡

techfossa@techfossa-demo-01:/$ sudo docker compose -f /data/dockerdata/uptimekuma/uptime-kuma.yaml up -d
[+] Running 1/1
 βœ” Container uptime-kuma  Started                                                                                                                   0.3s
techfossa@techfossa-demo-01:/$
Check the container status and the Uptime Kuma webinterface

Let's show all running containers now to see if Uptime Kuma is back:

sudo docker container ls

πŸ‘‡ Example output πŸ‘‡

techfossa@techfossa-demo-01:/$ sudo docker container ls
CONTAINER ID   IMAGE                           COMMAND                  CREATED              STATUS                        PORTS                                                                                            NAMES
69b1436d6077   louislam/uptime-kuma:1          "/usr/bin/dumb-init …"   About a minute ago   Up About a minute (healthy)   0.0.0.0:3001->3001/tcp, :::3001->3001/tcp                                                        uptime-kuma
730e9777e166   portainer/portainer-ce:latest   "/portainer"             12 days ago          Up 36 hours                   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer
techfossa@techfossa-demo-01:/$

Succes! Let's check the webinterface now.

Yes! πŸ’― We have a login page and after logging in the previous created monitors are still there.

Portainer

In a previous post we deployed a Portainer container. We are now going to use it to deploy Uptime Kuma again but now using the stack function of Portainer.

Check the Uptime Kuma container status and stop and delete it if needed

Login to your Portainer webinterface:

Click on the local section near the blue whale carrying loads of container:

Click on the Containers section or on Containers in the menu on the left of the page:

You should now see the Container list. If present and running select the uptime-kuma container click on the Stop button.

If the container has the state exited - code 0 select the container again and click the Remove button:

Choose Remove:

After this the uptime-kuma container should be gone from the list of Containers:

Create an Uptime Kuma stack using Portainer

We can now continue and create our first Portainer stack on this host. Select Stacks in the left menu:

Click on the blue + Add stack button:

Now enter uptime-kuma in the Name field and and enter (or copy paste) the lines below into the Web editor field:

services:
  uptime-kuma:
    container_name: uptime-kuma
    image: louislam/uptime-kuma:1
    ports:
      - "3001:3001"
    volumes:
      - /data/dockerdata/uptimekuma/data:/app/data
    restart: unless-stopped
Deploy the stack using Portainer

On the bottom left of the Create stack section click on the blue Deploy the stack button:

The uptime-kuma stack should be visible in the Stacks list:

Select Containers in het left menu. If all is well there should be a healthy uptime-kuma container present again:

Check Uptime KumaΒ 

The last step is checking the Uptime Kuma webinterface:

Nice. Uptime Kuma is working fine but now deployed as a stack. βœ”οΈ