Skip to content
Open
18 changes: 18 additions & 0 deletions doc/010_Setup_Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ In order to make sure that the kernel modules are properly loaded, you should re

Now you are ready to use docker!

### Cross Development for docker images

To develop for arm-based boards on x86, you can enable your host machine execute non-native binary formats using [QEMU](https://www.qemu.org) and [binfmt_misc](https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html).

When this is set up, docker is able to run images for the architectures supported by QEMU on your host machine (using CPU emulation).

There is a docker image that can do the settings for you: [see here](https://github.com/multiarch/qemu-user-static)

Quick enable:

sudo apt-get install qemu binfmt-support qemu-user-static
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes

Test it using e.g.

docker run --rm -ti arm64v8/ubuntu uname -m


### Using a registry
If you want to use the image generated by the docker build from this repository, you can also use the already build image from the registry server.

Expand Down
2 changes: 1 addition & 1 deletion docker_commands.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ init_docker(){
touch $GPUS_SETTINGS_FILE
docker run --gpus=all --rm $IMAGE_NAME > /dev/null
GPU_SUPPORTED=$?
echo "this file contains the gegerated result of testing the docker --gpu setting, 0=enabled, 1=disabled" > $GPUS_SETTINGS_FILE
echo "this file contains the generated result of testing the docker --gpu setting, 0=enabled, 1=disabled" > $GPUS_SETTINGS_FILE
echo $GPU_SUPPORTED >> $GPUS_SETTINGS_FILE
fi
HAS_GPU_SUPPORT=$(tail -n1 $GPUS_SETTINGS_FILE)
Expand Down
2 changes: 1 addition & 1 deletion exec.bash
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ DOCKER_RUN_ARGS=" \
--name $CONTAINER_NAME \
-e NUID=$(id -u) -e NGID=$(id -g) \
-u devel \
--dns $DNSIP \
${DNSIP:+--dns $DNSIP} \
-e DISPLAY -e QT_X11_NO_MITSHM=1 -v /tmp/.X11-unix:/tmp/.X11-unix \
$ADDITIONAL_DOCKER_RUN_ARGS \
$ADDITIONAL_DOCKER_MOUNT_ARGS \
Expand Down
15 changes: 7 additions & 8 deletions image_setup/01_base_images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ ENV DEBIAN_FRONTEND=noninteractive

# general requirements
RUN apt-get update && apt-get install -y \
build-essential \
apt-utils \
git \
wget \
cmake \
sudo \
build-essential \
cmake \
git \
locales \
python3 \
python3-dev \
locales
sudo \
wget

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
Expand All @@ -39,13 +38,13 @@ RUN /opt/install.bash ${INSTALL_ARGS}

ADD init_user_id.bash /opt/init_user_id.bash

# create user (usermod -u UID username will be used later to maybe adapt UID on fitst start).
# create user (usermod -u UID username will be used later to maybe adapt UID on first start).
# using salted password: openssl passwd -1 -salt xyz yourpass # pw UserRos
# RUN useradd -m -U -p '$1$xyz$pzVfEx0ZWLPizymvlx2P70' -G sudo,users rosuser
RUN groupadd devel-group
RUN useradd --shell /bin/bash -c "development user" -m -G devel-group devel

# set user sudoers previlege for start script (w/o password), the /opt/init_user_id.bash script
# set user sudoers privilege for start script (w/o password), the /opt/init_user_id.bash script
# is using NUID and NGID environment variables, but ist executed by the user using sudo, so these vars have to be kept
RUN echo "devel ALL=(ALL) NOPASSWD: ALL \
\nDefaults env_keep += \"NUID\" \
Expand Down
28 changes: 28 additions & 0 deletions image_setup/01_base_images/arm32v7/install_ros_dependencies.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#install ROS melodic (second install because needs gnupg)
export DEBIAN_FRONTEND=noninteractive

DISTRO=${1:-melodic}
[ $DISTRO == "noetic" ] && export vPYTHON=3

apt-get update && apt-get install -y \
lsb-release \
gnupg2 \
gosu \
ruby \
ruby-dev \
python$vPYTHON

sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
apt-get update && apt-get install -y \
ros-desktop \
python$vPYTHON-catkin-pkg \
python$vPYTHON-rosdep2 \
python$vPYTHON-rosinstall \
python$vPYTHON-rosinstall-generator \
python$vPYTHON-wstool


#rosdep init && rosdep update
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

#install ROS melodic (second install because needs gnupg)
export DEBIAN_FRONTEND=noninteractive

DISTRO=${1:-melodic}
[ $DISTRO == "noetic" ] && export vPYTHON=3

apt-get update && apt-get install -y \
lsb-release \
gnupg2 \
gosu \
ruby \
ruby-dev \
python$vPYTHON

sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
apt-get update && apt-get install -y \
ros-base \
python$vPYTHON-catkin-pkg \
python$vPYTHON-rosdep2 \
python$vPYTHON-rosinstall \
python$vPYTHON-rosinstall-generator \
python$vPYTHON-wstool


#rosdep init && rosdep update


28 changes: 28 additions & 0 deletions image_setup/01_base_images/arm64v8/install_ros_dependencies.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#install ROS melodic (second install because needs gnupg)
export DEBIAN_FRONTEND=noninteractive

DISTRO=${1:-melodic}
[ $DISTRO == "noetic" ] && export vPYTHON=3

apt-get update && apt-get install -y \
lsb-release \
gnupg2 \
gosu \
ruby \
ruby-dev \
python$vPYTHON

sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
apt-get update && apt-get install -y \
ros-desktop \
python$vPYTHON-catkin-pkg \
python$vPYTHON-rosdep2 \
python$vPYTHON-rosinstall \
python$vPYTHON-rosinstall-generator \
python$vPYTHON-wstool


#rosdep init && rosdep update
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#install ROS melodic (second install because needs gnupg)
export DEBIAN_FRONTEND=noninteractive

DISTRO=${1:-melodic}
[ $DISTRO == "noetic" ] && export vPYTHON=3

apt-get update && apt-get install -y \
lsb-release \
gnupg2 \
gosu \
ruby \
ruby-dev \
python$vPYTHON

sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
apt-get update && apt-get install -y \
ros-base \
python$vPYTHON-catkin-pkg \
python$vPYTHON-rosdep2 \
python$vPYTHON-rosinstall \
python$vPYTHON-rosinstall-generator \
python$vPYTHON-wstool


#rosdep init && rosdep update
16 changes: 11 additions & 5 deletions image_setup/01_base_images/build_plain_18.04.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/bin/bash

. ../../settings.bash
export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/plain_18.04

export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
export INSTALL_SCRIPT=install_plain_dependencies.bash
# manage base image name depending on selected $ARCH in settings.bash
if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then
export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
echo "Building for x86_64 processor. Using $BASE_IMAGE as base image."
else
export BASE_IMAGE=$ARCH/ubuntu:bionic
echo "Building for $ARCH processor. Using $BASE_IMAGE as base image."
fi

export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}plain_18.04
export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_plain_dependencies.bash

docker pull $BASE_IMAGE
docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT .



echo
echo "don't forget to push the image if you wish:"
echo "docker push $IMAGE_NAME:base"
Expand Down
16 changes: 11 additions & 5 deletions image_setup/01_base_images/build_plain_20.04.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/bin/bash

. ../../settings.bash
export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/plain_20.04

export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04
export INSTALL_SCRIPT=install_plain_dependencies.bash
# manage base image name depending on selected $ARCH in settings.bash
if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then
export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04
echo "Building for x86_64 processor. Using $BASE_IMAGE as base image."
else
export BASE_IMAGE=$ARCH/ubuntu:focal
echo "Building for $ARCH processor. Using $BASE_IMAGE as base image."
fi

export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}plain_20.04
export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_plain_dependencies.bash

docker pull $BASE_IMAGE
docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT .



echo
echo "don't forget to push the image if you wish:"
echo "docker push $IMAGE_NAME:base"
Expand Down
16 changes: 11 additions & 5 deletions image_setup/01_base_images/build_rock_master_16.04.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/bin/bash

. ../../settings.bash
export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/rock_master_16.04

export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu16.04
export INSTALL_SCRIPT=install_rock_dependencies.bash
# manage base image name depending on selected $ARCH in settings.bash
if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then
export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu16.04
echo "Building for x86_64 processor. Using $BASE_IMAGE as base image."
else
export BASE_IMAGE=$ARCH/ubuntu:xenial
echo "Building for $ARCH processor. Using $BASE_IMAGE as base image."
fi

export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}rock_master_16.04
export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_rock_dependencies.bash

docker pull $BASE_IMAGE
docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT .



echo
echo "don't forget to push the image if you wish:"
echo "docker push $IMAGE_NAME:base"
Expand Down
16 changes: 11 additions & 5 deletions image_setup/01_base_images/build_rock_master_18.04.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/bin/bash

. ../../settings.bash
export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/rock_master_18.04

export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
export INSTALL_SCRIPT=install_rock_dependencies.bash
# manage base image name depending on selected $ARCH in settings.bash
if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then
export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
echo "Building for x86_64 processor. Using $BASE_IMAGE as base image."
else
export BASE_IMAGE=$ARCH/ubuntu:bionic
echo "Building for $ARCH processor. Using $BASE_IMAGE as base image."
fi

export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}rock_master_18.04
export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_rock_dependencies.bash

docker pull $BASE_IMAGE
docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT .



echo
echo "don't forget to push the image if you wish:"
echo "docker push $IMAGE_NAME:base"
Expand Down
17 changes: 11 additions & 6 deletions image_setup/01_base_images/build_ros_melodic_18.04.bash
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
#!/bin/bash

. ../../settings.bash
export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/ros_melodic_18.04

export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
export INSTALL_SCRIPT=install_ros_dependencies.bash
# manage base image name depending on selected $ARCH in settings.bash
if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then
export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
echo "Building for x86_64 processor. Using $BASE_IMAGE as base image."
else
export BASE_IMAGE=$ARCH/ubuntu:bionic
echo "Building for $ARCH processor. Using $BASE_IMAGE as base image."
fi

export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}ros_melodic_18.04
export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_ros_dependencies.bash

docker pull $BASE_IMAGE
docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT .



echo
echo "don't forget to push the image if you wish:"
echo "docker push $IMAGE_NAME:base"
echo

17 changes: 11 additions & 6 deletions image_setup/01_base_images/build_ros_melodic_18.04_minimal.bash
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
#!/bin/bash

. ../../settings.bash
export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/ros_melodic_18.04_minimal

export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
export INSTALL_SCRIPT=install_ros_minimal_dependencies.bash
# manage base image name depending on selected $ARCH in settings.bash
if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then
export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04
echo "Building for x86_64 processor. Using $BASE_IMAGE as base image."
else
export BASE_IMAGE=$ARCH/ubuntu:bionic
echo "Building for $ARCH processor. Using $BASE_IMAGE as base image."
fi

export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}ros_melodic_18.04_minimal
export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_ros_minimal_dependencies.bash

docker pull $BASE_IMAGE
docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT .



echo
echo "don't forget to push the image if you wish:"
echo "docker push $IMAGE_NAME:base"
echo

Loading