Containerized MADS

docker
easy
OS
setup
Author
Affiliation

Paolo Bosetti

University of Trento

Published

June 2, 2025

Modified

February 27, 2026

Abstract

The base agents for setting up a MADS network are available as a containerized environment.

Contents

Setting up a MADS network requires a minimum of a broker, a MongoDB server, and the logger agent. This guide explains the easiest and more portable solution to have them up and running in minuts in a Docker environment.

Prerequisites

You need to have Docker installed on your machine. If you don’t have it yet, you can follow the official installation guide. Follow that guide thoroughly, and make sure you can run this command in your terminal:

docker run hello-world

Running MADS as a container

A MADS container image is available on Docker Hub, the official repository for Docker images. You can find it at MADS-NET/MADS_container.

You can fetch the MADS image with:

docker pull p4010/mads:latest

With that, you can use docker to run the image as if it were the usual mads command:

docker run --rm -it p4010/mads:latest -h

will provide the help message for the MADS command line interface, as if you had run mads -h on your host machine.

Note that mads command require a valid mads.ini file located in the etc folder of the mads prefix directory, which you can obtain by running the mads -p (i.e. docker run --rm -it p4010/mads -p). So you need to have a valid mads.ini file in a local folder and then mount that folder into the container with the -v option. For example, if you have a valid mads.ini file in the folder /path/to/mads/etc, you can run the broker command as follows:

docker run --rm -it -v /path/to/mads/etc/mads.ini:/usr/local/etc/mads.ini p4010/mads broker

you also want to map the ports, i.e. to expose to your host machine the ports opened by the container. The relevant docker option is -p, which maps a port on the host machine to a port on the container. For a typical MADS command, that would be:

docker run --rm -it -v /path/to/mads/etc/mads.ini:/usr/local/etc/mads.ini p4010/mads -p9090:9090 -p9092:9092 broker
Note

For brevity, you could define an alias on your shell:

alias dmads="docker run --rm -it -v /path/to/etc/mads.ini:/usr/local/etc/mads.ini -p9090:9090 -p9092:9092 p4010/mads"

and then simply use dmads in place of mads.

Running the MADS network

The MADS Network is actually available as a compose network of three containers: the broker, the MongoDB server, and the logger agent. Docker has a docker compose command that allows to build and deploy multiple, synchronized containers properly sharing network communications.

To find more on docker compose, have a look at the documentation.

Step 1. Clone the repo

All you need is in the MADS_container repository. You can clone it with the following command:

git clone --depth 1 https://github.com/MADS-NET/MADS_container.git

Step 2. Run the containers

You can now run the containers with the following command:

docker compose up -d

This starts the three containerized processes: MogoDB, the broker, and the logger agent.

Note

You can stop the containers at any time with the command docker compose down.

Now the broker and the database are also accessible as if they were processes running on your host machine.

Update images

To update the images to the latest version, do:

docker compose pull

from project root (i.e. the same folder containing compose.yml).

Back to top