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:
/mnt/docker/data/corrade/ is a host / local filesystem path where configuration files will be stored,
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/).
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/
Here is the Dockerfile that is placed at the root of the build system:
# add build arguments for specific architectures
ARG TARGETPLATFORM
# using alpine
FROM alpine:edge
# unzip required for unpacking Corrade and all the rest are libraries
RUN apk add --no-cache bash unzip curl icu-libs gcompat fontconfig ttf-dejavu libstdc++ dotnet9-runtime
# retrieve latest Corrade
RUN mkdir -p /tmo/kitchen
WORKDIR /tmp/kitchen
ARG TARGETOS
ARG TARGETARCH
RUN curl \
--retry 5 --max-time 120 --retry-delay 10 --retry-max-time 120 --retry-all-errors --retry-connrefused \
-fsSL "https://corrade.grimore.org/download/corrade/${TARGETOS}-${TARGETARCH}/LATEST.zip" -o /tmp/kitchen/Corrade.zip && \
unzip /tmp/kitchen/Corrade.zip -d /opt/corrade
# cleanup
WORKDIR /opt/corrade
RUN rm -rf /tmp/kitchen
# remove unneeded
RUN apk del -r unzip curl
# add filesystem requirements
ADD rootfs /
# expose just the Nucleus port, all the rest is up to the user
EXPOSE 54377
# HTTP, MQTT, TCP, UDP and WebSockets are not exposed but the user can map the port if they wish
# EXPOSE 8080 1883 8085 8086 8088
# Corrade volumes storing configuration
VOLUME /etc/corrade
# execute the bootstrapper that will start Corrade
ENTRYPOINT ["bash", "/usr/local/bin/run"]
# metadata labels
LABEL \
org.opencontainers.image.vendor="Corrade" \
org.opencontainers.image.authors="Wizardry and Steamworks <wizardry.steamworks@outlook.com>" \
org.opencontainers.image.title="Official Corrade Docker Container Image" \
org.opencontainers.image.description="the libOpenMetaverse scripted agent" \
org.opencontainers.image.version="latest" \
org.opencontainers.image.url="https://corrade.grimore.org/" \
org.opencontainers.image.licenses="MIT"
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).