CheckMk: Upgrade CheckMk using Docker Compose

This is about how to update or upgrade CheckMk inside a Docker container.

CheckMk: Upgrade CheckMk using Docker Compose

Upgrading or updating CheckMk inside a Docker container is quite as easy as installing it.

Here's my Docker compose file:

services:
  checkmk:
    image: checkmk/check-mk-raw:2.3.0-latest
    tmpfs: /opt/omd/sites/cmk/tmp:uid=1000,gid=1000
    volumes:
      - ./monitoring:/omd/sites
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 5000:5000
      - 8000:8000
    restart: always

I update the image and start the container:

# docker compose pull
# docker compose up -d
[+] Pulling 2/7
 ⠏ checkmk [⣿⣿⠀⠀⠀⠀] Pulling                                 13.0s
   ✔ 43f89b94cd7d Already exists                              0.0s
   ✔ 75953e234df6 Pull complete                               0.6s
   ⠹ 54fd41c1953d Downloading  12.37MB/127.4MB                6.3s
   ⠹ 099ad5783371 Downloading   12.4MB/216.2MB                6.3s
   ⠹ 996e05cfdeb5 Waiting                                     6.3s
   ⠹ cd83b88f379c Waiting                                     6.3s

After that, the container starts. We can watch what it's doing:

# docker compose logs -f
checkmk-1  | ### UPDATING SITE
checkmk-1  | Saving temporary filesystem contents...OK
checkmk-1  | Cleaning up tmp directory...OK
checkmk-1  | 2025-01-24 08:21:52 - Updating site 'cmk' from version 2.2.0p37.cre to 2.3.0p25.cre...
checkmk-1  |
checkmk-1  |  * Updated        etc/apache/apache.conf
checkmk-1  |  * Updated        etc/check_mk/apache.conf
checkmk-1  |  * Updated        etc/init.d/agent-receiver
checkmk-1  |  * Updated        etc/init.d/apache
checkmk-1  |  * Installed file etc/logrotate.d/audit
checkmk-1  |  * Installed file etc/logrotate.d/security
checkmk-1  |  * Updated        etc/mk-livestatus/nagios.cfg
checkmk-1  |  * Updated        etc/nagios/conf.d/check_mk_templates.cfg
checkmk-1  |  * Updated        etc/nagvis/apache.conf
checkmk-1  |  * Updated        etc/ssl/openssl.cnf
checkmk-1  |  * Updated        etc/ssl/openssl.cnf.dist
checkmk-1  |  * Updated        etc/ssl/misc/CA.pl
checkmk-1  |  * Updated        etc/ssl/misc/tsget
checkmk-1  |  * Updated        etc/ssl/misc/tsget.pl
checkmk-1  |  * Installed dir  local/lib/python3/cmk_addons
checkmk-1  |  * Installed dir  local/lib/python3/cmk/plugins
checkmk-1  |  * Installed dir  local/lib/python3/cmk_addons/plugins
checkmk-1  |  * Vanished       etc/cron.d/cmk_discovery
checkmk-1  | Temporary filesystem already mounted
checkmk-1  |
checkmk-1  | -| ATTENTION
checkmk-1  | -|   Some steps may take a long time depending on your installation.
checkmk-1  | -|   Please be patient.
checkmk-1  | -|
checkmk-1  | -| Cleanup precompiled host and folder files
checkmk-1  | -| Verifying Checkmk configuration...
checkmk-1  | -|  01/06 Legacy check plug-ins...
checkmk-1  | -|  02/06 Rulesets...
checkmk-1  | -|  03/06 UI extensions...
checkmk-1  | -|  04/06 Agent based plugins...
checkmk-1  | -|  05/06 Autochecks...
checkmk-1  | -|  06/06 Deprecated .mk configuration of plugins...
checkmk-1  | -| Done (success)
checkmk-1  | -|
checkmk-1  |
checkmk-1  | Completed verifying site configuration. Your site now has version 2.3.0p25.cre.
checkmk-1  | Executing update-pre-hooks script "01_mkp-disable-outdated"...OK
checkmk-1  | Executing update-pre-hooks script "02_cmk-update-config"...
checkmk-1  | -| ATTENTION
checkmk-1  | -|   Some steps may take a long time depending on your installation.
checkmk-1  | -|   Please be patient.
checkmk-1  | -|
checkmk-1  | -| Cleanup precompiled host and folder files
checkmk-1  | -| Verifying Checkmk configuration...
checkmk-1  | -|  01/06 Legacy check plug-ins...
checkmk-1  | -|  02/06 Rulesets...
checkmk-1  | -|  03/06 UI extensions...
checkmk-1  | -|  04/06 Agent based plugins...
checkmk-1  | -|  05/06 Autochecks...
checkmk-1  | -|  06/06 Deprecated .mk configuration of plugins...
checkmk-1  | -| Done (success)
checkmk-1  | -|
checkmk-1  | -| Updating Checkmk configuration...
checkmk-1  | -|  01/24 Create precompiled host and folder files...
checkmk-1  | -|  02/24 Validate user IDs...
checkmk-1  | -|  03/24 Convert WATO audit log to be newline separated...
checkmk-1  | -|  04/24 Update views...
checkmk-1  | -|  05/24 Update dashboards...
checkmk-1  | -|  06/24 User attributes...
checkmk-1  | -|  07/24 Global settings...
checkmk-1  | -|  08/24 Rulesets...
checkmk-1  | -|  09/24 Autochecks...
checkmk-1  | -|  10/24 Hosts and folders...
checkmk-1  | -|  11/24 Migrate CLI parent scan config...
checkmk-1  | -|  12/24 Cleanup version specific caches...
checkmk-1  | -|  13/24 Delete old dedicated agent receiver cert...
checkmk-1  | -|  14/24 Synchronize automationuser secrets...
checkmk-1  | -|  15/24 Check for incompatible password hashes...
checkmk-1  | -|  16/24 Remove unreadable prediction files...
checkmk-1  | -|  17/24 Update existing two factor...
checkmk-1  | -|  18/24 Update pagetypes...
checkmk-1  | -|  19/24 Split large audit logs...
checkmk-1  | -|  20/24 Event Console: Rewrite active config...
checkmk-1  | -|  21/24 Sanitize audit log...
checkmk-1  | -| Wrote audit log backup to /omd/sites/cmk/audit_log_backup. Please check if the audit log in the GUI works as expected.
checkmk-1  | -| In case of problems you can copy the backup files back to /omd/sites/cmk/var/check_mk/wato/log.
checkmk-1  | -| Please check the corresponding files in /omd/sites/cmk/var/check_mk/wato/log for any leftover automation secrets and remove them if necessary.
checkmk-1  | -| If everything works as expected you can remove the backup.
checkmk-1  | -| For further details please have a look at Werk #17056.
checkmk-1  | -|  22/24 Remove persisted graph options...
checkmk-1  | -|  23/24 BI config...
checkmk-1  | -|  24/24 Update core config...
checkmk-1  | -| Generating configuration for core (type nagios)...
checkmk-1  | -| Precompiling host checks...OK
checkmk-1  | -| Done (success)
checkmk-1  | OK
checkmk-1  | Finished update.
checkmk-1  |
checkmk-1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
checkmk-1  | Reloading Apache...httpd not running, trying to start
checkmk-1  | httpd not running, trying to start
checkmk-1  | OK
checkmk-1  | ### STARTING XINETD
checkmk-1  |  * Starting internet superserver xinetd
checkmk-1  |    ...done.
checkmk-1  | ### STARTING SITE
checkmk-1  | Starting agent-receiver...OK
checkmk-1  | Starting mkeventd...OK
checkmk-1  | Starting rrdcached...OK
checkmk-1  | Starting npcd...OK
checkmk-1  | Starting nagios...OK
checkmk-1  | Starting apache...OK
checkmk-1  | Starting redis...OK
checkmk-1  | Initializing Crontab...OK
checkmk-1  | Temporary filesystem already mounted
checkmk-1  | ### STARTING CRON
checkmk-1  | ### CONTAINER STARTED

The container now runs the new image, but CheckMk is still running the old release or version. Because of that, it has to be updated.

I need a login to the container:

# docker exec -ti checkmk-checkmk-1 bash
su - cmk
OMD[cmk]:~$

After that, I advise CheckMk to perform an update:

OMD[cmk]:~$ cmk -U
Generating configuration for core (type nagios)...
Precompiling host checks...OK
Validating Nagios configuration...OK
OMD[cmk]:~$ cmk -V
This is Check_MK version 2.3.0p25 CRE

After that, CheckMk is online running the latest binaries.

We now have to activate this configuration change:

In case of an upgrade, we have to acknowledge that some Werks are not compatible any more:

You should also consider to upgrade all agents on monitored systems. And you should check if you are using monitoring plugins which can be upgraded. But be careful: Don't simply upgrade plugins if you changed them - review updates!