Skip to content

Instantly share code, notes, and snippets.

@babo
Last active April 27, 2018 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save babo/94309eac327209ca68867fb579bb12be to your computer and use it in GitHub Desktop.
Save babo/94309eac327209ca68867fb579bb12be to your computer and use it in GitHub Desktop.
Docker image with nVidia GPU and ROS support, used for Udacity Self Driving Car nanodegree capstone project.
FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
LABEL maintainer="attila.babo@gmail.com"
# Install ROS Kinetic robot
# install packages
RUN apt-get update && apt-get install -y --no-install-recommends \
dirmngr \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list
# install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
python-rosdep \
python-rosinstall \
python-vcstools \
&& rm -rf /var/lib/apt/lists/*
# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
# bootstrap rosdep
RUN rosdep init \
&& rosdep update
# install ros packages
ENV ROS_DISTRO kinetic
RUN apt-get update && apt-get install -y \
ros-kinetic-ros-core=1.3.2-0* \
ros-kinetic-ros-base=1.3.2-0* \
ros-kinetic-robot=1.3.2-0* \
&& rm -rf /var/lib/apt/lists/*
# End of ROS Kinetic Robot
# Install Dataspeed DBW https://goo.gl/KFSYi1 from binary
# adding Dataspeed server to apt
RUN sh -c 'echo "deb [ arch=amd64 ] http://packages.dataspeedinc.com/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-dataspeed-public.list'
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FF6D3CDA
RUN apt-get update
# setup rosdep
RUN sh -c 'echo "yaml http://packages.dataspeedinc.com/ros/ros-public-'$ROS_DISTRO'.yaml '$ROS_DISTRO'" > /etc/ros/rosdep/sources.list.d/30-dataspeed-public-'$ROS_DISTRO'.list'
RUN rosdep update
RUN apt-get install -y ros-$ROS_DISTRO-dbw-mkz
RUN apt-get upgrade -y
# end installing Dataspeed DBW
# install python packages
RUN apt-get install -y python-pip
RUN pip install --upgrade pip
COPY requirements.txt ./requirements.txt
COPY requirements_gpu.txt ./requirements_gpu.txt
RUN pip install -r requirements_gpu.txt
# install required ros dependencies
RUN apt-get install -y ros-$ROS_DISTRO-cv-bridge
RUN apt-get install -y ros-$ROS_DISTRO-pcl-ros
RUN apt-get install -y ros-$ROS_DISTRO-image-proc
# socket io
RUN apt-get install -y netbase
# install some useful packages for interactive work
RUN apt-get install -y tmux vim less
# Clean up
RUN rm -rf /var/lib/apt/lists/*
# Capstone specific
RUN mkdir /capstone
VOLUME ["/capstone"]
VOLUME ["/root/.ros/log/"]
WORKDIR /capstone/ros
# setup entrypoint
COPY ./ros_entrypoint.sh /
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
@joe3141592
Copy link

Hi, nice work!! I get some errors:
Reading state information... Done
E: Version '1.3.1-0*' for 'ros-kinetic-ros-core' was not found
E: Version '1.3.1-0*' for 'ros-kinetic-ros-base' was not found
E: Version '1.3.1-0*' for 'ros-kinetic-robot' was not found

Can you help me on that? :(

@babo
Copy link
Author

babo commented Apr 27, 2018

Please try the new Dockerfile above, I updated the packages to the current 1.3.2 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment