├── Dockerfile ├── README.md ├── build.sh └── run.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ros:indigo 2 | 3 | # Arguments 4 | ARG user 5 | ARG uid 6 | ARG home 7 | ARG workspace 8 | ARG shell 9 | 10 | # Basic Utilities 11 | RUN apt-get -y update && apt-get install -y zsh screen tree sudo ssh synaptic 12 | 13 | # Latest X11 / mesa GL 14 | RUN apt-get install -y\ 15 | xserver-xorg-dev-lts-wily\ 16 | libegl1-mesa-dev-lts-wily\ 17 | libgl1-mesa-dev-lts-wily\ 18 | libgbm-dev-lts-wily\ 19 | mesa-common-dev-lts-wily\ 20 | libgles2-mesa-lts-wily\ 21 | libwayland-egl1-mesa-lts-wily\ 22 | libopenvg1-mesa 23 | 24 | # Dependencies required to build rviz 25 | RUN apt-get install -y\ 26 | qt4-dev-tools\ 27 | libqt5core5a libqt5dbus5 libqt5gui5 libwayland-client0\ 28 | libwayland-server0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1\ 29 | libxcb-render-util0 libxcb-util0 libxcb-xkb1 libxkbcommon-x11-0\ 30 | libxkbcommon0 31 | 32 | # The rest of ROS-desktop 33 | RUN apt-get install -y ros-indigo-desktop-full 34 | 35 | # Additional development tools 36 | RUN apt-get install -y x11-apps python-pip build-essential 37 | RUN pip install catkin_tools 38 | 39 | # Make SSH available 40 | EXPOSE 22 41 | 42 | # Mount the user's home directory 43 | VOLUME "${home}" 44 | 45 | # Clone user into docker image and set up X11 sharing 46 | RUN \ 47 | echo "${user}:x:${uid}:${uid}:${user},,,:${home}:${shell}" >> /etc/passwd && \ 48 | echo "${user}:x:${uid}:" >> /etc/group && \ 49 | echo "${user} ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/${user}" && \ 50 | chmod 0440 "/etc/sudoers.d/${user}" 51 | 52 | # Switch to user 53 | USER "${user}" 54 | # This is required for sharing Xauthority 55 | ENV QT_X11_NO_MITSHM=1 56 | ENV CATKIN_TOPLEVEL_WS="${workspace}/devel" 57 | # Switch to the workspace 58 | WORKDIR ${workspace} 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## rosdocked 2 | 3 | Run ROS Indigo / Ubuntu Trusty within Docker on Ubuntu Xenial or on any platform with a shared 4 | username, home directory, and X11. 5 | 6 | This enables you to build and run a persistent ROS Indigo workspace as long as 7 | you can run Docker images. 8 | 9 | Note that any changes made outside of your home directory from within the Docker environment will not persist. If you want to add additional binary packages without having to reinstall them each time, add them to the Dockerfile and rebuild. 10 | 11 | For more info on Docker see here: https://docs.docker.com/engine/installation/linux/ubuntulinux/ 12 | 13 | ### Build 14 | 15 | This will create the image with your user/group ID and home directory. 16 | 17 | ``` 18 | ./build.sh IMAGE_NAME 19 | ``` 20 | 21 | ### Run 22 | 23 | This will run the docker image. 24 | 25 | ``` 26 | ./dock.sh IMAGE_NAME 27 | ``` 28 | 29 | The image shares it's network interface with the host, so you can run this in 30 | multiple terminals for multiple hooks into the docker environment. 31 | 32 | ### Whale 33 | 34 | 🐳 35 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Check args 4 | if [ "$#" -ne 1 ]; then 5 | echo "usage: ./build.sh IMAGE_NAME" 6 | return 1 7 | fi 8 | 9 | # Get this script's path 10 | pushd `dirname $0` > /dev/null 11 | SCRIPTPATH=`pwd` 12 | popd > /dev/null 13 | 14 | # Build the docker image 15 | docker build\ 16 | --build-arg user=$USER\ 17 | --build-arg uid=$UID\ 18 | --build-arg home=$HOME\ 19 | --build-arg workspace=$SCRIPTPATH\ 20 | --build-arg shell=$SHELL\ 21 | -t $1 . 22 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Check args 4 | if [ "$#" -ne 1 ]; then 5 | echo "usage: ./run.sh IMAGE_NAME" 6 | return 1 7 | fi 8 | 9 | # Get this script's path 10 | pushd `dirname $0` > /dev/null 11 | SCRIPTPATH=`pwd` 12 | popd > /dev/null 13 | 14 | set -e 15 | 16 | # Run the container with shared X11 17 | docker run\ 18 | --net=host\ 19 | -e SHELL\ 20 | -e DISPLAY\ 21 | -e DOCKER=1\ 22 | -v "$HOME:$HOME:rw"\ 23 | -v "/tmp/.X11-unix:/tmp/.X11-unix:rw"\ 24 | -it $1 $SHELL 25 | --------------------------------------------------------------------------------