1. Checkmk in a Docker container
In our installation guide for Checkmk in Docker we’ve already shown you how to set up Checkmk in a Docker container. This article takes a closer look at more of the details.
2. Optional parameters during the setup
All of the following parameters are specified additionally when setting up a Checkmk site as a container and are therefore not available separately.
2.1. Using HTTPS
If Checkmk is the only web server on your dockernode, you can also bind the
port to the standard (
80) HTTP port. As soon as you you have multiple
web servers on a dockernode however, you will probably use a reverse-proxy
like NGINX – this directs the inquiries to the correct container. With this
technology you can also use (possibly preexisting) HTTPS. The reverse proxy
will then be addressed via HTTPS, while communicating with the container
continues via HTTP.
2.2. Setting an initial password
In Checkmk, when creating a site a random password for the default user
cmkadmin is created.
When creating a Checkmk container you can also
assign a password manually. Simply add the
-e CMK_PASSWORD='mypassword' option during the creation process.
2.3. Setting your own instance ID
With the default command to create a Checkmk container, the ID of the instance
created in the container will be
cmk. This is important to be able to
access the instance via HTTP(S) and it must therefore be explicit. If you have
multiple containers of Checkmk on the same dockernode, you will have to set the ID
manually to ensure this uniqueness. You can do that by including the
2.4. Sending notifications
An important feature of Checkmk is the sending of notifications per email. Checkmk uses Postfix as its MTA (Mail Transfer Agent) for outgoing mails. This postfix instance is configured not to deliver mails directly to the recipient, but basically tries to forward to an additional mail server (SMTP Relay Server, Smarthost) which you need to provide outside of the container. Such a relay server is available in almost every organization.
When implementing, specify the relay mail server that will forward the notifications.
MAIL_RELAY_HOST variable — e.g.,
-e MAIL_RELAY_HOST='mailrelay.mydomain.com'. If the mail server expects a specific host name, add the following
Checkmk containers currently do not support the configuration of access data for a smart host. You can bind a postfix configuration or configuration folder from the docker node if you need them.
If you use one of the Checkmk Enterprise Editions, you are able to bypass postfix completely so that Checkmk forwards notifications directly to a smarthost. This is done by the synchronous SMTP, which is described in detail in the article about notifications. Here an authentification over SMTP is also possible.
2.5. Access to Livestatus via TCP
As soon you connect multiple Checkmk containers/instances together
in a distributed environment you will need a special TCP port for the
Livestatus interface. This interface allows communication between the
instances. Bind this port – likewise the port for HTTP – to one of the
Docker nodes, and enable this TCP port in the Livestatus instance:
CMK_LIVESTATUS_TCP=on -p 6557:6557.
2.6. Access via the command line
In some cases you will want to execute commands on the command line.
Because commands for an instance are always executed via a special user,
you must specify this when logging in. In Checkmk the user always has the
same name as the instance it manages. Specify the user
cmk with the
-u cmk option:
root@linux# docker container exec -it -u cmk monitoring bash
You can then pass your commands to the instance.
2.7. Using the Event Console
Checkmk is able to receive SNMP traps and syslog messages. To be able
to use this feature in a Checkmk container, the standardized ports must
be provided to the Checkmk container with the following options:
162:162/udp -p 514:514/udp -p 514:514/tcp. In order that the instance
itself also respects these ports, next activate the the appropriate add-ons
in the instance with
omd config. You can
find these in the
root@linux# docker container exec -it -u cmk monitoring bash OMD[mysite]:~$ omd config
3. Useful commands
docker inspect myContainer
With this command you can get all sorts of information about a running container with the name