Table of Contents

TL;DR

docker run \
    -d \
    --restart always
    -p 54377:54377 \                               # Nucleus (required)
    -p 8080:8080 \                                 # HTTP server
    -p 1883:1883 \                                 # MQTT server
    -p 8085:8085 \                                 # TCP server
    -p 8086:8086 \                                 # UDP server
    -p 8088:8088 \                                 # WebSockets server
    -v /mnt/docker/data/corrade/:/etc/corrade \
     wizardrysteamworks/corrade:latest

where:

About

Corrade run within a docker container using our official image on DockerHUB. The usage pattern is typical to running Corrade from the command line: the container is started, the user connects to the Nucleus port 54377 to configure Corrade, and then Corrade logs in to the grid.

The configuration files NucleusConfiguration.xml, CorradeConfiguration.xml and Log4Net.config are exported to the local path given by the volume mount (in the TL;DR section, that is /mnt/docker/data/corrade/).

Compose

Here is the Docker compose file that does the same but using docker-compose and it should also be compatible with docker swarm:

version: "3.7"

services:
  corrade:
    image: wizardryandsteamworks/corrade
    ports:
      - "54377:54377" # Nucleus (required)
      - "8080:8080"   # HTTP server
      - "1883:1883"   # MQTT server
      - "8085:8085"   # TCP
      - "8086:8086"   # UDP
      - "8088:8088"   # Websockets server
    volumes:
      - /mnt/docker/data/corrade/:/corrade/

Dockerfile

Here is the Dockerfile that is placed at the root of the build system:

# for libssl compatiblity required for .net 5.0
FROM debian:bullseye-slim
 
# update package manager
RUN  apt-get update -y && \
     apt-get upgrade -y && \
     apt-get dist-upgrade -y && \
     apt-get -y autoremove && \
     apt-get clean
 
# unzip required for unpacking Corrade and all the rest are libraries
RUN apt-get install -y \
    coreutils \
    bash \
    unzip \
    libgssapi-krb5-2 \
    libssl1.1 \
    libicu67 \
    curl \
    libgdiplus \
    libc6-dev 
 
# retrieve latest Corrade
WORKDIR /tmp
RUN curl -fsSSL https://corrade.grimore.org/download/corrade/linux-x64/LATEST.zip -o /tmp/Corrade.zip && \
    unzip /tmp/Corrade.zip -d /corrade
 
# open port declaration, in order: Nucleus, HTTP, MQTT, TCP, UDP and WebSockets
EXPOSE 54377 8080 1883 8085 8086 8088
 
# add filesystem requirements
ADD rootfs /
 
# execute the bootstrapper that will start Corrade
ENTRYPOINT ["bash", "/usr/local/bin/run"]

Developer Notes

Some voodoo is performed by the run script that moves the configuration files to /etc/corrade, that will be exported to the host via a volume mount, and then the script creates back(sym)links to the Corrade directory such that some of the configuration files can be exposed in order to not resort to bind mounts.

It is fairly acceptable to resort to bind mounts; that is, expose the whole Corrade directory, even if it is docker-unorthodox to do so, but due to Nucleus that uses a lot of small files, as well as the Corrade cache that keeps growing, synchronizing the files between host and container takes a while (a long while, it took 15 minutes on the clock, as a cold start).

Index