umr-ds / maci-docker-compose

A docker-compose setup of MACI with pluggable workers, supporting MiniNet, NS-3 and CORE
https://maci-research.net/
0 stars 1 forks source link

MACI Docker

This repository provides a set of instructions to create Docker containers to start a full working set of the MACI framework published on https://maci-research.net/

The service is launched with Docker Compose initiating and connecting different Containers:

Getting Started

Setup Docker

#run as root
apt-get update
apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install docker-ce
curl -L https://github.com/docker/compose/releases/download/1.15.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
service docker start

Load Submodules

The MACI framework is loaded as a git submodule and needs to be loaded before starting the container:

git submodule init
git submodule update --remote

Start Backend with a Mininet Worker

The command below starts all required containers. Replace <WORKER> with the worker you wish. The MACI WebUI will be available at http://localhost:63658

docker-compose -f docker-compose.yml -f mininet.yml up

Stop Backend

docker-compose -f docker-compose.yml -f mininet.yml down

Configuring Workers

Bootstraping Methods

docker pull maciresearch/maci-backend
docker pull maciresearch/core_worker
docker pull macireserach/ns3_worker
docker pull maciresearch/mininet_worker
docker build -t maciresearch/maci-backend maci-backend/
docker build -t maciresearch/mininet_worker mininet_worker/
docker build -t maciresearch/core_worker core_worker/
docker build -t maciresearch/ns3_worker ns3_worker/

Scale Number of local Workers

Run instances of one (core | ns3 | mininet | ...).

docker-compose -f docker-compose.yml -f <WORKER>.yml --scale <WORKER>=<N> up

Start remote workers

  1. Build or pull the Docker images as before.
  2. Run a worker and provide the backend address from the worker's perspectiveand idle shutdown time (optional):
docker run --rm --privileged  -v /lib/modules:/lib/modules -e BACKEND=<BACKEND_ADDRESS> -e IDLE=3600 -d maciresearch/mininet_worker
CORE Worker: In addition to the extended privileges it also needs NET_ADMIN linux kernel capabilities and access to the kernel modules:
docker run --rm --privileged  -v /lib/modules:/lib/modules -e BACKEND=<BACKEND_ADDRESS> -e IDLE=3600 -d  --cap-add=NET_ADMIN maciresearch/core_worker

For development purposes there is a core-gui adaption. The container tries to connect to an x server running on your desktop. Important: authorize the host to connect: xhost + <DOCKER_HOST_IP>, Docker for mac users can use the hostname docker.for.mac.localhost.

docker run --rm --privileged  -v /lib/modules:/lib/modules -it --cap-add=NET_ADMIN -e DISPLAY=docker.for.mac.localhost:0 maciresearch/core_worker
Mininet WiFi: In addition to the granted privileges mininet-wifi needs also access to the host network and a mounted /sys folder:
docker run --rm --privileged --net=host -v /sys:/sys -e BACKEND=<BACKEND_ADDRESS> -e IDLE=3600 -d --cap-add=ALL maciresearch/mininet-wifi_worker

Stop the container

... using the id provided after start:

docker stop <CONTAINER_ID>

Contact