Skip to content
Mabel Zhang edited this page Jul 21, 2021 · 19 revisions

Build and Use Docker Image for Noetic/Gazebo11 Support

  • The notes cover options for both with and without NVIDIA GPU support. Where the instructions diverge, you will see options a) NVIDIA and b) Non-NVIDIA. Both variants use the same Dockerfile, but
  • These notes are based on using an anecdotal testing
    • NVIDIA variant tested on both Ubuntu 20.04 and Ubuntu 18.04 hosts.
    • Non-NVIDIA variant tested on Ubuntu 20.04 using Virtualbox. Using this setup the sim reported a real-time factor of 1.0 and a frame rate of ~2 FPS.

Setup Host

Install and setup docker

a) NVIDIA Option

NVIDIA Install Guide

which includes this test...

sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

b) Non-NVIDIA Option

Install docker on your host. E.g., for Ubuntu 20.04 here are instructions.

Make sure you pass the test...

sudo docker run hello-world

Verify Docker Version

Check your version of Docker, you should see something like...

docker -v
Docker version 20.10.2, build 2291f61

Add local user to the docker group

See Docker: Post-installation steps for Linux

sudo usermod -aG docker $USER

You will need to re-login for this to take complete effect, but for a particular bash session you can

su - $USER

Install rocker

Use apt as described in the rocker README.md.

Also required

sudo apt install python3-distutils

Build Docker Image

cd dave/docker
./build.bash dave_noetic

which should generate output that ends with something like...

Successfully built ae7e6aa86be9
Successfully tagged dave_nvidia:2021_07_01_1052
Built dave_nvidia:2021_07_01_1052 and tagged as dave_nvidia:latest

Development Use-Case

Start Container from Image

Use rocker to start a container from the image.

a) NVIDIA Option

The run.bash script wraps the rocker interface...

./run.bash dave_nvidia:latest

a) Non-NVIDIA Option

rocker --devices /dev/input/js0 --dev-helpers --x11 --user --home --git dave:latest

Note that the argument for the devices option should be the path to the joystick device on the host. This can be omitted if a joystick is not needed.

Join Multiple Terminals

You will probably want to have multiple terminal within the container. To do so, you can execute an interactive bash session in the running container. A short bash script is supplied which will find the running container by image name and open a new shell in that container.

First, you need to find the ID of the image generated by rocker. You can get this from the last line of the rocker output, or you can run:

docker ps

and copy the hash of the image corresponding to the container you want to join. Then run the join.bash script with this image hash as the argument, as follows:

cd dave/docker
./join.bash <IMAGE_HASH>

e.g.,

cd dave/docker
./join.bash dave_nvidia_runtime

Test

Ad-hoc testing by running one of the Dave demo's, e.g., vehicle_examples

Clone this wiki locally