Running a Minion with Docker is relatively easy, you just need to have Docker installed. It makes also updating the Minion very easy cause you can follow the tags latest for latest stable version or trying a bleeding snapshot. You can configure everything through environment variables. At a bare minimum you need something like this:

docker run --rm -d \
  -e "TZ=Europe/Berlin" \
  -e "MINION_LOCATION=Apex-Office" \
  -e "OPENNMS_BROKER_URL=tcp://opennms-ip:61616" \
  -e "OPENNMS_HTTP_URL=http://opennms-ip:8980/opennms" \
  -e "OPENNMS_HTTP_USER=minion" \
  -e "OPENNMS_HTTP_PASS=minion" \
  -e "OPENNMS_BROKER_USER=minion" \
  -e "OPENNMS_BROKER_PASS=minion" \
  -e "JAVA_OPTS=-Xms128M -Xmx384M" \
  opennms/minion:latest -c

Using docker run --rm takes care you don't have state in the image and it is deleted as soon you stop the process. As simple this is to start and configure a Minion, this approach has two disadvantages:

  • The credentials used for authentication can be exposed to logs
  • It is a one-shot command you run from the CLI and it will not survive reboots

To address the credentials problem please read the Dealing with Credentials section in our readme which explains how to avoid this.

The second part is relatively easy to address using Docker Compose and systemd. You need two things, a Docker compose file which describes and configures the service and a systemd unit file. You can find a docker-compose.ymlexample in our repository. Download it the file modify it to your needs in the following directory structure /etc/docker/minion/docker-compose.yml.

Create a docker-compose service unit file with the following content /etc/systemd/system/[email protected]:

Description=%i service with docker compose

ExecStart=/usr/local/bin/docker-compose up
ExecStop=/usr/local/bin/docker-compose stop


You can now enable and start your service with systemctl enable docker-compose@minion and systemctl start docker-compose@minion. If you want you can now add more Docker Compose services in any subdirectory and control them with systemd.

gl & hf

Jump to section

About the Author: Ronny

I've started as an OpenNMS community member in 2004 and I'm working as a full-time contributor at the OpenNMS Group since 2015.
Published On: May 20th, 2018Last Updated: April 4th, 20192 min readTags: ,