This directory contains a few Dockerfiles and supporting scripts. See each section below for usage information about
This section describes how to build and run a docker image based on nightly builds of downstream Ignition libraries. The Docker image will use the Ignition Gazebo code found in the current source tree.
Requirements
-
Optional: Install NVidia Docker
Nvidia docker will be needed if you plan to run the GUI and/or sensors after the Docker image is built.
Steps
-
Change the root directory of the Ignition Gazebo source tree. If you are currently in the
docker
subdirectory:cd ..
-
Build the ign-gazebo:base image.
docker build . -f ./docker/Dockerfile.base -t ign-gazebo:base
-
Build the nightly docker image.
docker build . -f ./docker/Dockerfile.nightly -t ign-gazebo:nightly
-
Run the docker image with a bash shell.
docker run -it ign-gazebo:nightly /bin/bash
-
Alternatively, you can directly run Ignition Gazebo using
./docker/run.bash ign-gazebo:nightly ign-gazebo-server -v 4
This section describes how to build and run a docker image of an Ignition distribution using debians.
Requirements
Steps
-
Build a docker image using the
build.bash
command. The first argument must be the name of the Ignition distribution. For example, to build an image of Ignition Blueprint:./build.bash ignition-blueprint ./Dockerfile.ignition
-
Run the docker image using
run.bash
, and pass in the name of the docker image (first argument to the build.bash script)../run.bash ignition-blueprint
-
You can pass arguments to Ignition Gazebo by appending them the
run.bash
command. For example, to load the shapes.sdf file:./run.bash ignition-blueprint -f shapes.sdf
Here you'll find general information, such as installation of Docker and how to use Nvidia with Docker.
Docker has two available versions: Community Edition (CE) and Enterprise Edition (EE). In this tutorial, we'll install the CE version.
-
Remove old versions of Docker (if installed):
sudo apt-get remove docker docker-engine docker.io
-
Install dependencies and keys.
sudo apt install curl apt-transport-https ca-certificates curl software-properties-common # Add the official GPG key of Docker curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-
Setup Docker using 1 of the two options below.
-
Ubuntu Bionic users
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
-
Everyone else.
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-
-
Install Docker
sudo apt-get update && sudo apt-get install docker-ce
-
Check your Docker installation:
sudo docker run hello-world
-
You should see the message
Hello from Docker!
confirming that your installation was successfully completed.
-
Remove old versions of Nvidia Docker:
docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f sudo apt-get purge -y nvidia-docker
-
Setup the Nvidia Docker repository.
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update
-
Install Nvidia Docker (version 2):
sudo apt-get install -y nvidia-docker2
-
Restart the Docker daemon
sudo service docker restart
-
Verify the installation:
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
This command should print your GPU information, for example:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.116 Driver Version: 390.116 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 960 Off | 00000000:01:00.0 On | N/A |
| 0% 51C P5 12W / 160W | 775MiB / 2000MiB | 1% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+