Container build instructions

The containers in this repository can be pulled directly from the singularity-hub container registry as follows:

build <CONTAINER_NAME>.simg shub://rickstaa/panda_autograsp:ros-kinetic-cuda10-xenial

It can also be built from the recipe file using the following command:

sudo singularity <CONTAINER_NAME>.simg shub://rickstaa/panda_autograsp:ros-kinetic-cuda10-xenial

You can also add the --sandbox argument to build the container as a writeable folder.

Warning

You need root access to build from a recipe file.

Container run instructions

After the container is built, you can use the singularity shell, start and run commands to interact with the container. You are advised to use the run command since this also sources a .singularity_bashrc file that is present in each of the containers. This file can be used as a .bashrc file. You can run the singularity container using one of the following run commands:

  • With Nvidia GPU: $ singularity run --nv <YOUR_CONTAINER_NAME>

  • Without Nvidia GPU: $ singularity run <YOUR_CONTAINER_NAME>

Note

Additionally, you can also add the --writable parameter to the run command to receive write permissions.

Additional container instructions

Container aliases

To increase convenience a number of bash aliases were added to the containers:

  • atf: activates the tf-gpu conda environment

  • dtf: deactivates the tf-gpu conda environment

  • dconda: deactivates the conda enviroment

  • rsource: sources the ROS setup.bash file

  • rossu: sources the setup.bash file at ./devel/setup.bash

You can unset these aliases or add additional aliases by creating a ~/.singularity_bash_aliases file in your user home directory. If such a ~/.singularity_bash_aliases file is present in your home folder, it will be sourced after the container its ~/.singularity_bash_aliases file.

Container .bashrc

A .singularity_bashrc file is present inside the containers. This file is sourced when you run the container. You can overload all of the commands, aliases and settings contained in this .singularity_bashrc file by creating your own ~/.singularity_bashrc file in your home folder. If such a ~/.singularity_bashrc file is present in your home folder, it will be sourced after the container its ~/.singularity_bashrc file.

Container permissions

By default your user can not write to the container folder when begin outside of the container. If you did build the singularity container as a writeable folder you can give your user write and read access from outside the singularity container by:

  1. Changing the group owner to your user group.

sudo chgrp -R <YOUR_USER_NAME> ./<YOUR_CONTAINER_NAME>
  1. Giving your user group _read and write_ access to the <YOUR_CONTAINER_NAME folder.

sudo chmod -R g+rwx ./<YOUR_CONTAINER_NAME>

Add a visual code IDE to the singularity container

Visual studio code can be added to the singularity container in order to enable easy code debugging. This is done as follows:

  1. Run your container using the sudo singularity run --writable <YOUR_CONTAINER_NAME>

  2. Install visual code or visual code-insiders using the following bash commands:

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

Note

Since visual code requires the /run folder you need to add the -B /run argument when running a singularity container. For more information see this issue.