Skip to content

Cloudsim Docker Compose

Nate Koenig edited this page Mar 19, 2021 · 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

  1. Create a JSON file that contains information about your SubT setup. The json2docker.rb script can generate a sample JSON file using:
       cd ~/subt_ws/src/subt/docker

       ./json2docker.rb -e > sample.json
  1. The json2docker.rb can be used to run this JSON file using docker-compose.
       ./json2docker.rb -f sample.json -r

The sample JSON file launches a SubT simulation image with two robots, two bridge images, and two solution images (one for each robot).

Customization

  1. Modify the JSON file used by json2docker to include your robot platforms with the appropriate docker images.

  2. Additional options, including specification of the bridge and simulation docker images, are available using -h command line option.

       ./json2docker.rb -h

Troubleshooting

Couldn't open X display :1

      # 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

      ./json2docker.rb -f <your_json_files> -r

Next, running cloudsim locally using Catkin

ERROR: Pool overlaps with other one on this address space

Chances are you need to clean up your docker network. This can be done by running:

docker network prune
Clone this wiki locally