Last Updated:

Change our Uptime Kuma update steps using Docker Compose

Tech Fossa
Tech Fossa Containers

After using more Docker Containers you learn more about them. ๐Ÿค“
We are gonna change a few things on our demo machine regarding Docker and the Uptime Kuma Docker Container.

Table of Contents

Add user to the Docker group

With the current setup showing the Docker Container overview and status is not possible with our demo user. All Docker commands need more privileges to be executed which is not ideal. Check out the example below before and after the current user is added to the Docker group.

โŒจ Enter the command below๐Ÿ’ป

docker container ps

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ docker container ps
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.47/containers/json": dial unix /var/run/docker.sock: connect: permission denied

This command does work using the sudo command:

โŒจ Enter the command below๐Ÿ’ป

sudo docker container ps

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ sudo docker container ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED        STATUS                    PORTS                                                                                            NAMES
5b44c3736861   portainer/portainer-ce:latest   "/portainer"             4 months ago   Up 29 minutes             0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer
a4953c7db586   louislam/uptime-kuma:1          "/usr/bin/dumb-init โ€ฆ"   5 months ago   Up 29 minutes (healthy)   0.0.0.0:3001->3001/tcp, :::3001->3001/tcp                                                        uptime-kuma

Now let's add the the current user to the Docker group:

โŒจ Enter the command below๐Ÿ’ป

sudo usermod -aG docker $USER

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ sudo usermod -aG docker $USER
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

No error or other notification which is the expected result.
Now first log off and on again to make this change effective

Now execute the command again:

โŒจ Enter the command below๐Ÿ’ป

docker container ps

๐Ÿ‘‡ Example output ๐Ÿ‘‡ after logging off and on again:

techfossa@techfossa-demo-01:~$ docker container ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED        STATUS                    PORTS                                                                                            NAMES
5b44c3736861   portainer/portainer-ce:latest   "/portainer"             4 months ago   Up 47 minutes             0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer
a4953c7db586   louislam/uptime-kuma:1          "/usr/bin/dumb-init โ€ฆ"   5 months ago   Up 47 minutes (healthy)   0.0.0.0:3001->3001/tcp, :::3001->3001/tcp                                                        uptime-kuma

Succes! ๐Ÿ’ฏ

Only use Docker Compose commands to update the Uptime Kuma Container

As you have seen we were working in the /data/dockerdata/uptimekuma directory before.
This directory contains the Uptime Kuma yaml configuration file and the Volume directory to save data.

Navigate to the folder containing the Docker Compose file, in this case /data/dockerdata/uptimekuma

โŒจ Enter the command below๐Ÿ’ป

cd /data/dockerdata/uptimekuma

โŒจ Enter the command below๐Ÿ’ป

ls

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ ls
data  uptime-kuma.yaml

We are gonna change the name of the file uptime-kuma.yaml to docker-compose.yml using the mv command.

โŒจ Enter the command below๐Ÿ’ป

sudo mv uptime-kuma.yaml docker-compose.yml

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ sudo mv uptime-kuma.yaml docker-compose.yml
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

Again: no error or other notification which is the expected result.
Show the directory content again:

โŒจ Enter the command below๐Ÿ’ป

ls

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ ls
data  docker-compose.yml

Before updating

Before updating (if there is any update) first check if Uptime Kuma is functioning properly.

Update the Uptima Kuma container

Navigate to the folder containing the Docker Compose file, in this case /data/dockerdata/uptimekuma

โŒจ Enter the command below๐Ÿ’ป

cd /data/dockerdata/uptimekuma

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/$ cd /data/dockerdata/uptimekuma
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

We can now bring down/stop the Uptime Kuma Container

โŒจ Enter the command below๐Ÿ’ป

docker compose down

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ docker compose down
[+] Running 1/1
 โœ” Network uptimekuma_default  Removed                                                                                                                 0.3s
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

Use the docker compose pull command to pull/download a new version of the image file of Uptime Kuma (if available)

โŒจ Enter the command below๐Ÿ’ป

docker compose pull

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ docker compose pull
[+] Pulling 13/13
 โœ” uptime-kuma Pulled   10.2s
   โœ” b338562f40a7 Pull complete  1.8s
   โœ” 874bf4d93720 Pull complete  1.9s
   โœ” b16337721583 Pull complete 2.9s
   โœ” 7d955db85b85 Pull complete 3.0s
   โœ” 2c706596bd17 Pull complete 3.0s
   โœ” 88a5c59ed14f Pull complete  3.0s
   โœ” 5a1d0a896c33 Pull complete  3.9s
   โœ” e68c2f25b946 Pull complete  4.2s
   โœ” 2e6c90f010d6 Pull complete  4.2s
   โœ” ff15b10fabb8 Pull complete  4.3s
   โœ” 4f4fb700ef54 Pull complete  4.3s
   โœ” d2a400cc8adb Pull complete 8.5s
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

In my case for some reason the Uptime Kuma Container was not stopped. An extra command was needed to stop/bring down the Container and continue the update ๐Ÿคฏ

โŒจ Enter the command below๐Ÿ’ป

 docker container stop uptime-kuma

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ docker container stop uptime-kuma
uptime-kuma
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

Now remove the current Uptime Kuma container.

โŒจ Enter the command below๐Ÿ’ป

docker rm uptime-kuma

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ docker rm uptime-kuma
uptime-kuma
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

Start the Uptime Kuma container in detachedย  (-d) mode which means it will keep running after you log off.

โŒจ Enter the command below๐Ÿ’ป

docker compose up -d

๐Ÿ‘‡ Example output ๐Ÿ‘‡

techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$ docker compose up -d
[+] Running 2/2
 โœ” Network uptimekuma_default  Created           0.1s
 โœ” Container uptime-kuma       Started                0.3s
techfossa@techfossa-demo-01:/data/dockerdata/uptimekuma$

After refreshing the Uptime Kuma interface the New Update notification is gone and the About section is showing that version 1.23.16 is now active. ๐Ÿ’ฏ