Skip to content

Setup Docker

Emiliano Borghi edited this page Mar 16, 2021 · 19 revisions

Setup Docker image for local development

This guide explains how to setup Docker for local development NOT intended to be used in a robot.

Index

  1. Prerequisites

    a. Create workspace

    b. Install Docker

    c. Install nvidia-container-toolkit

  2. Build the image

  3. Start the container

Step 0: Prerequisites

Step a: Create workspace

  • Create the following directory structure in your machine
mkdir -p ~/create_ws/src
  • Clone this repo inside
cd ~/create_ws/src

git clone [email protected]:RoboticaUtnFrba/create_autonomy.git

This process will require you to setup your SSH keys. More information can be found in this Jupyter Notebook.

Step b: Install Docker

Install docker and configure after post-installing it:

sudo apt-get update

sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

To run docker without superuser:

sudo groupadd docker
        
sudo gpasswd -a ${USER} docker
        
sudo service docker restart

Step c: Install nvidia-container-toolkit

In order to use the GPU within Docker, you need to install nvidia-container-toolkit.

sudo apt-get install -y nvidia-container-toolkit

Notes:

  • For Ubuntu 20.04, this step might not work. If so, check this link.

  • Reboot the machine after moving onto the next step.

Step 1: Build the image

The development image needs to be built the first time, and it will install all the dependencies that the robot will require.

Go to the root of this repository and execute:

cd cd ~/create_ws/src/create_autonomy

./docker/build

This step may take a lot of time!

Step 2: Start the container

To execute the container, you can use the run script:

./docker/run