Migrating from a regular Linux host to a Docker host: insanely difficult, or did I do it the hard way?

Hi,

You didn’t do it the hard way by mistake — you hit a real documentation gap. @martin.hirschvogel

Your approach was essentially correct, but there is a cleaner path that avoids most of the pain, particularly the cmk_docker.conf issue that cost you the most time.

The Core Problem

When you restore a backup from a native Linux installation into a Docker container, the Docker-specific Apache configuration file cmk_docker.conf is missing. This file tells Apache to listen on 0.0.0.0 instead of 127.0.0.1, which is required for the web interface to be reachable from outside the container. This is nowhere documented in the official Checkmk docs for this migration path — so your hours of debugging were not your fault.

The Cleaner Migration Path

Step 1 — Backup on the old Linux host

bash

omd stop mysite
omd backup /tmp/mysite_backup.tar.gz
scp /tmp/mysite_backup.tar.gz newserver:/opt/cmk-data/

Step 2 — Start the container with the correct Site ID from the beginning

You can set the site ID directly using the -e CMK_SITE_ID=mysite environment variable Checkmk — this avoids the whole rename/disable dance with the default cmk site entirely.

docker-compose.yml
# docker-compose.yml
version: "3.7"
services:
  checkmk:
    image: checkmk/check-mk-raw:2.4.0-latest
    container_name: monitoring
    restart: always
    environment:
      CMK_SITE_ID: "mysite"       # must match your backup's site name!
      CMK_PASSWORD: "changeme"
      TZ: "Europe/Berlin"
    ports:
      - "8080:5000"
      - "8000:8000"
    volumes:
      - /opt/cmk-data:/omd/sites
      - /etc/localtime:/etc/localtime:ro
    tmpfs:
      - /opt/omd/sites/mysite/tmp:uid=1000,gid=1000

Step 3 — Restore inside the container

bash

# Shell into the container
docker exec -it monitoring bash

# Stop the freshly created empty site
omd stop mysite

# Restore from backup (--reuse overwrites the existing empty site)
omd restore --reuse --kill /omd/sites/mysite_backup.tar.gz

Step 4 — Fix the missing Docker Apache config

This is the step that cost you the most time. After restoring a native Linux backup, you need to either copy or recreate the Docker-specific Apache config:

bash

# Option A: copy from the default cmk site if it still exists
cp /omd/sites/cmk/etc/apache/conf.d/cmk_docker.conf \
   /omd/sites/mysite/etc/apache/conf.d/

# Option B: set it via omd config directly
omd config mysite set APACHE_TCP_ADDR 0.0.0.0
omd config mysite set APACHE_TCP_PORT 5000

# Then start the site
omd start mysite

Your workaround of manually copying cmk_docker.conf was exactly the right fix !!!

Greetz Bernd

4 Likes