-
Notifications
You must be signed in to change notification settings - Fork 98
Cloudsim Docker Compose
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.
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.
-
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
-
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
-
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
- 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
- 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).
-
Modify the JSON file used by
json2docker
to include your robot platforms with the appropriate docker images. -
Additional options, including specification of the bridge and simulation docker images, are available using
-h
command line option.
./json2docker.rb -h
# 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
Chances are you need to clean up your docker network. This can be done by running:
docker network prune