Skip to content

Cloudsim Docker Compose

Nate Koenig edited this page Sep 10, 2020 · 5 revisions

This setup replicates the cloud simulation setup for the SubT Virtual Testbed. We highly recommend developing and testing against a local replica of Cloudsim. Your turn-around time will be much faster, and you can easily introspect running simulations locally.

SubTCDC.png

Docker Compose is a tool for defining and running multi-container Docker images. With Compose, you use a YAML file to configure the SubT Cloudsim on a local system.

Prerequisites

Docker Compose relies on Docker Engine, so make sure you have Docker Engine installed.

Install Compose on Ubuntu

  1. Run this command to download the current stable release of Docker Compose:

    sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

  2. Apply executable permissions to the binary:

    sudo chmod +x /usr/local/bin/docker-compose

  3. Test the installation.

      docker-compose --version`
      docker-compose version 1.24.1, build 1110ad01

Note: If you have Docker Engine version >= 19.03 installed, then you need add the content below into the /etc/docker/daemon.json file for --runtime=nvidia to work. More info here.

      cd /etc/docker/
      sudo vim daemon.json

      # Add this into the file:

      {
          "runtimes": {
              "nvidia": {
                  "path": "/usr/bin/nvidia-container-runtime",
                  "runtimeArgs": []
              }
          }
      }

      sudo service docker restart

Run the SubT example solution

       cd ~/subt_ws/src/subt/docker

       ./run_docker_compose.sh

The default docker-compose.yml file launches a SubT simulation image with two robots, two bridge images, and two solution images (one for each robot).

Customization

  1. Modify the sim sevice's command: line in the docker-compose.yml file to include the number and type of robots you need.

  2. Each robot requires both a bridge and solution container. Modify the bridge container's command: to include only one of the robots specified in the sim command. Modify the solution container's image to be your own solution. Also, create another relay_net for the bridge and solution containers.

Resolving the Couldn't open X display :1 issue:

      # Check if the /tmp/.docker.xauth files/directory exist:

      ls -la /tmp | grep docker

      # If you see instance listed, then remove them:

      sudo rm -rfv /tmp/.docker.xauth

      # Try to launch docker-compose again

      # Pass the circuit name when launching docker-compose  (e.g. tunnel, urban, cave)
      ./run_docker_compose.sh [circuit]

Next, running cloudsim locally using Catkin

Clone this wiki locally