Skip to content

Run MONICA in Docker and Singularity

Sanny Schulz edited this page Aug 12, 2019 · 2 revisions

There is a Docker image for MONICA. zalfrpm/monica-cluster

It is build on Debian9 as base.

It runs MONICA with an input proxy, an output proxy and an adjustable amount of MONICA working processes. A container is meant to run on a multiprocessor machine as a service.

docker run -p <input port>:6666 -p <output port>:7777 --env monica_instances=<number of monica worker> --rm --name <monica cluster name> zalfrpm/monica-cluster:<tag>

Parameter explained:

  • zalfrpm/monica-cluster:<tag> - image name on docker hub find the available tags here

  • -p <input port>:6666 - (optional) input port, without this parameter a random port will be chosen by docker

  • -p <output port>:7777 - (optional) output port, without this parameter a random port will be chosen by docker

  • --env monica_instances=<number of monica worker> - (optional) set number of monica worker processes that will be started, default is 3.

  • --rm - (optional) remove the container when stopped

  • --name <monica cluster name> - (optional) human readable name


docker run -p 6666:6666 -p 7777:7777 --env monica_instances=9 --rm --name my-monica-cluster zalfrpm/monica-cluster:


It is possible to use the 'latest' tag. Though it is recommended to use a specific version to create reproducible results.

Running Monica in Singularity

  • build a singularity image with docker as blueprint

    singularity pull docker://zalfrpm/monica-cluster:<tag>

run proxy as a service

shell script:

#!/bin/bash -x
VERSION= # or higher
#create a log output folder for proxy
mkdir -p ~${MOUNT_LOG}
export monica_intern_in_port=6677
export monica_intern_out_port=7788
export monica_consumer_port=7777
export monica_producer_port=6666
export monica_autostart_proxies=true
export monica_autostart_worker=false
export monica_auto_restart_proxies=true
export monica_auto_restart_worker=false
singularity instance start -B $MOUNT_LOG:$LOGOUT ${SINGULARITY_IMAGE} monica_proxy
nohup singularity run instance://monica_proxy  > /dev/null 2>&1 &


You can stop the container by using: singularity instance stop monica_proxy

run monica worker

Use this script in a job system, such as SLURM

shell script for SLURM:

#!/bin/bash -x
VERSION=      # or higher
NUM_WORKER=10          # number of cores used
PROXY_SERVER=localhost # host where your proxy is running
#create a log output folder
mkdir -p $MOUNT_LOG
export monica_instances=$NUM_WORKER
export monica_intern_in_port=${INTERN_IN_PORT}
export monica_intern_out_port=${INTERN_OUT_PORT}
export monica_autostart_proxies=false
export monica_autostart_worker=true
export monica_auto_restart_proxies=false
export monica_auto_restart_worker=true
export monica_proxy_in_host=$PROXY_SERVER
export monica_proxy_out_host=$PROXY_SERVER


If you don’t use it in a Job system, you should start it as a singularity service (singularity instance start, see proxy)

You can’t perform that action at this time.