Skip to content

Using the Docker Image

Marc Hanheide edited this page Jan 29, 2025 · 25 revisions

Using the Module's DevContainer

All software required is deployed as a Docker image, provided as a DevContainer, allowing anyone to run this on any computer that has Docker and Microsoft Visual Studio Code (VSCode) installed.

Note: If you want to use your own device, read the "Home/Own Device Installation" below.

The containerised development environment is made available as a "development container" "DevContainer" (no need to understand this fully, but it is an important professional software development toolkit). The used image is heavily customised for the work within the Lincoln Centre for Autonomous Systems (L-CAS) and contains a ROS2 Humble development environment with all software required for your work ready to go.

You are provided with a GitHub Repository, that has the DevContainer preconfigured for you and which you should use for your own development. Please see here: https://github.com/UoL-SoCS/cmp3103-ws. Basically, you should create your own Git Repository based on this template repository.

It is a good practice to download the latest version of the Docker image of the module manually, as it will take a while (a few minutes usually). Once downloaded, it is cached locally and future uses are quick.

It's a good idea to run this command that pulls the latest version every week before starting your work as it ensures you have the latest patches available

docker pull lcas.lincoln.ac.uk/devcontainer/ros2-teaching:4

The documentation of how you use that development container or "DevContainer" can be found in https://github.com/UoL-SoCS/cmp3103-ws/blob/main/README.md.

After your work, shut everything down

  1. stop all processes inside the terminals of your VSCode environment (e.g. with [ctrl-c] in the terminals)
  2. make sure you have saved all your work somewhere, e.g. on GitHub
  3. Close VSCode
  4. On your own computer, you may want to manually remove the container to free its resources. You can do it in the Docker Desktop GU or using docker rm ....
  5. Shutdown or reboot your computer
  6. If you are on a shared computer (e.g. the lab PCs), make sure you log out of everything, and you remove any files etc. (The Lab PCs are configured to delete files saved to delete files on restart. On Windows all files will be removed, but on Ubuntu only some folders such as, the Documents, Downloads, and Desktop. Please make sure you only work inside these folders.)

Important Notes / Common Issues:

Note: Any changes you make in the container are generally volatile. They are deleted when your dev container is closed and/or deleted. So please make sure you store all your work properly on a source revision system like GitHub. You are strongly adviced to use your own repository based on https://github.com/UoL-SoCS/cmp3103-ws for your work. You should always commit all your code changes before you close VSCode or the devContainer.

Note: Remember that if you are working on shared computer (e.g. in the labs), make sure you shutdown or reboot your computer after use to make sure all your private data is removed.

Note: If you have installed Docker with sudo on linux, you may receive the following error message when logging in Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/auth": dial unix /var/run/docker.sock: connect: permission denied. If this is the case, make sure to add your local user to the docker group by running sudo adduser <YOURUSERNAME> docker.

Home/Own Device Installation

If you want to work on your own device, these instructions are for you. Please note: While we will attempt to help you with this installation during workshop hours, we cannot guarantee that it will work on your own computer. If you have Docker and VSCode installed correctly, then the chances are high that it will work, but performance may not be as good as you experience in the officially supported Computer Labs at UoL.

Install the Basics

  1. Install Docker following the official installation guides for your operating system
  2. Install Visual Studio Code
  3. In VS Code, install the Dev Containers extension

Add 3D GPU support (optionally)

Optional for NVIDIA GPU support if your computer has a modern NVIDIA GPU (without it you can run the DevContainer, but there is no 3D acceleration in the container):

  1. Follow the NVIDIA Container Toolkit Installation Guide or here for Docker Desktop on Windows.

Note: Installing the NVIDIA Container Toolkit is an advanced topic, and you may encouter issues (e.g. if you have incompatible software, drivers, games, etc installed). You can use the DevContainer without, so try that first.

Try it out

First, ensure Docker is properly installed and running by executing a simple test command:

docker info
docker run --rm hello-world

Now try if you can pull the module's Docker image (this will take a while as the image is a few Gbytes):

docker pull lcas.lincoln.ac.uk/devcontainer/ros2-teaching:4

(You might notice that we run our own Docker Image Registry at lcas.lincolnac.uk.)

If you're using Windows or MacOS, make sure that Docker Desktop is running correctly.