Docker Image for the Udacity Self-Driving Car Nanodegree (with UI)

I tried to automate the process of getting started working on projects for the Udacity Car Nanodegree. So, if you’re in the first cohort, or will be part of the next ones, this post may be of interest to you.

The only extra dependency is Docker (and maybe a VNC viewer if you don’t have one installed). And only minimum familiarity with it is needed for the following to work (namely, being able to pull and run a Docker image):

$ docker pull yrahal/udacity-carnd
$ cd /path/to/your/CarND-LaneLines-P1
$ docker run -it -v “$PWD”:/src -p 5900:5900 yrahal/udacity-carnd

This will run x11vnc inside an Ubuntu container on port 5900. You can use your preferred VNC viewer to connect to localhost:5900 (the username is empty and the password is 1234).

Once inside the container, you’ll find yourself in the /src directory which is now mapped to your CarND-LaneLines-P1 folder on the host. jupyter notebook will launch the notebook inside Firefox with all the features. The window manager is IceWM, but I think it’s acceptable for our purposes. The code lives on the host machine, so you won’t lose anything that was written to the /src folder when the container exits. Everything else will be discarded. But you can create an image from a container if needed.

The image I created is at https://hub.docker.com/r/yrahal/udacity-carnd, and is built based on the install steps required for the Lane Lines Finding Project (first project of the Nanodegree). The Dockerfile I used to create the container is inspired from the Anaconda3 Dockerfile and on instructions on how to run a VNC server inside a container.

I will continue updating the image and tag it accordingly as the Nanodegree progresses and more software is needed to work on the next projects.

Notes

Running x11vnc is not needed. In fact, it is quite easy to override it and launch a shell, like so:

$ docker run -it -v “$PWD”:/src yrahal/udacity-carnd bash

Or:

$ docker run -it -v “$PWD”:/src yrahal/udacity-carnd python your_script.py

Which will run your_sript.py and exit the container (as long as you don’t need to display anything, otherwise, you’ll have to go the x11vnc route).

Other options (changing the ports, changing the working directory, the volume mappings, etc) are also possible. Please refer to the corresponding Docker Documentation for more info.