I have picked up Brian’s work and been able to get an image up and running that completes the installation, flash the PX2, and is able to compile and run the DriveWorks samples. This is the complete Dockerfile:
FROM ubuntu:16.04
# Needed to be able to install resolvconf without complaints about /etc/resolv.conf not being accessible
# See: https://github.com/moby/moby/issues/1297#issuecomment-115458690
RUN echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-selections
RUN apt-get update \
&& apt-get install -y \
chromium-browser \
dmidecode \
kmod \
libcanberra-gtk3-module \
libgtk2.0-0 \
lsb-core \
lsof \
minicom \
resolvconf \
software-properties-common \
sudo \
tzdata \
udev \
unzip \
usbutils \
vim \
x11-utils \
xterm \
&& apt-get -y autoremove && apt-get -y clean && rm -rf /var/lib/apt/lists/*
# Set up time and locale
# /etc/localtime is replaced by an actual file instead of symbolic link,
# otherwise DriveInstall can end up trying to copy the same file to itself
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen && \
rm /etc/localtime && \
cp /usr/share/zoneinfo/Etc/UTC /etc/localtime
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# You can set these when building the image, with the `--build-args` flag
ARG HOST_UID=1000
ARG HOST_GID=1000
ENV HOST_UID ${HOST_UID}
ENV HOST_GID ${HOST_GID}
RUN useradd --create-home --uid ${HOST_UID} --groups sudo --shell /bin/bash developer \
&& echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer \
&& chmod 0440 /etc/sudoers.d/developer
ENV HOME /home/developer
USER developer
WORKDIR /home/developer
CMD bash
The following script builds an image based on this, and runs DriveInstall in silent mode, including flashing the PX2 if you have it connected to the host through USB A-A:
#!/bin/bash
echo "Building base docker image..."
if ! nvidia-docker build \
--build-arg HOST_UID=$(id -u) \
--build-arg HOST_GID=$(id -g) \
-t driveworks:base .; then
echo "ERROR: failed building base docker image"
exit 1
fi
echo "Done"
echo "***** DOWNLOAD DriveInstall AND PLACE THE .run FILE IN $(pwd)"
echo "**"
echo "** https://developer.nvidia.com/nvidia-drive-downloads"
echo "**"
echo "** TO BE ABLE TO RUN THE FULL PROCESS INCLUDING FLASHING THE PX2,"
echo "** HAVE THE PX2 CONNECTED THROUGH USB A-A TO HOST AND TO 10GB ETH PORT,"
echo "** AND SWITCHED ON"
echo "**"
read -n1 -rp "***** Press any key to continue when done..." key
echo
DRIVE_INSTALL=$(ls DriveInstall*)
if [ "x$DRIVE_INSTALL" == "x" ]; then
echo "ERROR: DriveInstall not found"
exit 1
fi
if ! docker run -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
-v $(pwd):/home/developer \
-e launcher_silent_mode=install \
-e development_platform=autochauffeur \
--privileged \
--device /dev/ttyUSB0 \
--device /dev/ttyUSB1 \
--device /dev/ttyUSB2 \
--device /dev/ttyUSB3 \
--device /dev/ttyUSB4 \
--device /dev/ttyUSB5 \
--device /dev/ttyUSB6 \
--device /dev/ttyUSB7 \
-v /dev/bus/usb:/dev/bus/usb \
driveworks:base bash -c ./$DRIVE_INSTALL; then
echo "WARNING: DriveInstall returned an error code, it may be that your Docker image is not complete. If this happened when it got to flashing the PX2 and you don't have it connected, you should be fine."
fi
docker commit $(docker ps -l -q) driveworks:sdk
This results in a docker image tagged driveworks:sdk
. The following is a script to run it, ensuring the nvidia drivers and runtime of your host (host-host? :) )are available:
#!/bin/bash
NVIDIA_DRIVER_VERSION=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -n 1 | cut -d '.' -f 1)
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
-v $(pwd):/home/developer \
--privileged \
--device /dev/ttyUSB0 \
--device /dev/ttyUSB1 \
--device /dev/ttyUSB2 \
--device /dev/ttyUSB3 \
--device /dev/ttyUSB4 \
--device /dev/ttyUSB5 \
--device /dev/ttyUSB6 \
--device /dev/ttyUSB7 \
-v /dev/bus/usb:/dev/bus/usb \
-v /usr/lib/nvidia-${NVIDIA_DRIVER_VERSION}:/usr/lib/nvidia-${NVIDIA_DRIVER_VERSION} \
-e LD_LIBRARY_PATH=/usr/lib/nvidia-${NVIDIA_DRIVER_VERSION} \
--runtime=nvidia \
driveworks:sdk bash
When running, you should be able to read the docs:
chromium-browser /usr/local/driveworks/doc/index.html
And build and run the samples:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release /usr/local/driveworks/samples/
make -j
./src/hello_world/sample_hello_world
Hope that works for you!