Created
September 28, 2014 04:02
-
-
Save tntmarket/8e1eae6ef39ae584e832 to your computer and use it in GitHub Desktop.
Example Dockerfile for a ROS Hydro image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Dockerfile starts from a base ubuntu 12.04 image and installs | |
# a full desktop ROS hydro. | |
# | |
# It also creates a catkin workspace for a single user named YOURNAME | |
# with password YOURPASSWORD. | |
# | |
# GUI applications in the container will connect to the host's X11 server | |
# by mounting the .X11-unix folder on the host OS. I have no idea if this | |
# works on Mac if Windows. | |
# (http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/) | |
# | |
# Another alternative is to install a VNC server inside the container and | |
# remote desktop into it. Yet another alternative is to ssh into the container | |
# with X11 forwarding. I haven't tried either those options. | |
# | |
# I use this ROS environment by running a terminal emulator, using it | |
# exclusively to run ROS programs. The actual editing of source code | |
# happens on my host OS. This requires exposing a folder to the container | |
# with the -v option in "docker run". | |
# (https://docs.docker.com/userguide/dockervolumes/) | |
FROM ubuntu:precise | |
MAINTAINER Dave Lu | |
# Add universe repository | |
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise main universe" >> /etc/apt/sources.list | |
# Install things needed to add ROS repository | |
RUN apt-get update && apt-get install -y \ | |
apt-utils \ | |
wget \ | |
ca-certificates | |
# Install ROS Packages | |
RUN echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list | |
RUN wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | apt-key add - | |
RUN apt-get update && apt-get install -y \ | |
ros-hydro-desktop-full \ | |
python-rosinstall \ | |
ros-hydro-turtlebot* \ | |
ros-hydro-rqt \ | |
ros-hydro-rqt-common-plugins | |
# Add user | |
RUN useradd YOURNAME -m | |
RUN echo "YOURNAME:YOURPASSWORD" | chpasswd | |
# Initialize ROS | |
RUN rosdep init | |
USER YOURNAME | |
RUN rosdep update | |
# Setup catkin workspace | |
RUN echo "source /opt/ros/hydro/setup.bash" >> ~/.bashrc | |
RUN bin/bash -c "source /opt/ros/hydro/setup.bash && \ | |
mkdir -p ~/catkin_ws/src && \ | |
cd ~/catkin_ws/src && \ | |
catkin_init_workspace && \ | |
cd ~/catkin_ws/ && \ | |
catkin_make" | |
RUN echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc | |
# This is needed to run GUI applications | |
ENV DISPLAY localhost:0 | |
############################################################################# | |
######################### Graphics Card (Optional) ########################## | |
############################################################################# | |
# Install graphics card driver, if applicable | |
# Make sure the driver is the same version as the your host's | |
ADD ./nvidia /tmp/nvidia | |
RUN /tmp/nvidia/NVIDIA-Linux-x86_64-340.32.run -s -N --no-kernel-module | |
############################################################################# | |
############################ Other Custom Stuff ############################# | |
############################################################################# | |
# Install terminal emulator and font of choice | |
USER root | |
RUN apt-get update && apt-get install -y \ | |
terminator \ | |
ttf-inconsolata | |
RUN chsh -s /bin/bash YOURNAME | |
USER YOURNAME | |
# Install preferred ls scheme | |
RUN echo "eval \`dircolors -b ~/dircolors\`" >> ~/.bashrc | |
RUN wget -O ~/dircolors "https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.256dark" | |
# Install preferred ls scheme | |
ADD ./config /home/YOURNAME/.config/ | |
# Images generated from this should be run with two options: | |
# -v /tmp/.X11-unix:/tmp/.X11-unix (to display on the host X server, this is | |
# needed to run GUI applications) | |
# --privileged (to access the graphics card) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment