Updating dockerized Check_MK

If you are running the official Check_MK Docker image you will sooner or later have to implement a newer version of Check_MK. In this short article I will describe the procedure to update a Check_MK system which is running with docker and is described by Docker Compose.

Before beginning the actual update, you should create a backup of Check_MK. Since I am running it using docker-compose, all my files reside in a single directory. This can of course be different for your use case.

cp -r docker/checkmk /home/user/checkmk_backup

Update

To update the Check_MK files, a new temporary container is being created which is running the newer version of Check_MK to which you want to update. Most importantly, the directories of your existing Check_MK are being attached to the new container.

For example, the following command will run a new container using the image of version 1.5.0p16 and the directories of the container “checkmk” will be attached to this new container.

docker container run -t -d --rm --volumes-from checkmk --name checkmk_update checkmk/check-mk-raw:1.5.0p16 bash

The following command will then query the version of the existing container named “checkmk” and will copy it to the new container named “checkmk_update”.

docker cp -L checkmk:/omd/versions/default - | docker cp - checkmk_update:/omd/versions/

Now the actual update on the files can be performed.

docker exec -it -u cmk checkmk_update omd update

During the process you will be asked again if you want to update.

The update should finish with the message “Finished Update.”. The temporary container named “checkmk_update” can then be deleted.

docker kill checkmk_update

If you want to save space on your system, you can afterwards delete the old Check_MK Docker image (docker image ls and docker image rm).

To finish the whole procedure, the Check_MK version should be updated in the docker-compose file and the container should be restarted.

vi docker-compose.yml
version: '3'
services:
checkmk:
image: checkmk/check-mk-raw:1.5.0p15

should in my case be changed to:

version: '3'
services:
checkmk:
image: checkmk/check-mk-raw:1.5.0p16

To restart the containers run the following command.

docker-compose down && docker-compose up -d

After finishing, the updated Check_MK version should be shown in the web interface.

Script for automation

Since I didn’t want to run every single command everytime I want to update, I have created a script which will take care of that.

It can be found at: https://github.com/bjarneeins/compose-checkmk-updater

Add a Comment

Your email address will not be published. Required fields are marked *