How to run ifm3d-ros2 from inside a Docker container

Follow these steps to get our supplied Docker container to run on your system.


The instructions below apply to ROS2 Humble. Please change the commands to suit your ROS 2 distribution.

Build the docker container

We provide a Dockerfile and a build script to help you build a docker container with ifm3d and ifm3d-ros2. To use it, check out the script. Open it up and adjust the arguments to suit your target architecture (arm64v8 or amd64) and the targeted ifm3d and ifm3d-ros2 version. Then you can build the container:

$ ./
[+] Building 675.3s (23/23) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                    0.0s
 => => transferring dockerfile: 2.92kB                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                         0.0s
 => [internal] load metadata for                                                                                                  1.1s
 => [internal] load metadata for                                                                                                           0.9s
 => [auth] arm64v8/ros:pull token for                                                                                                              0.0s
 => CACHED [build 1/9] FROM                                        0.0s
 => CACHED                                                                0.6s
 => CACHED [stage-1 1/7] FROM                             0.0s
 => [build 2/9] RUN id ifm 2>/dev/null || useradd --uid 30000 --create-home -s /bin/bash -U ifm                                                                         0.5s
 => [build 3/9] WORKDIR /home/ifm                                                                                                                                       0.0s
 => [build 4/9] RUN apt-get update && apt-get install -y     git     jq     libxmlrpc-c++8-dev     libproj-dev     build-essential     coreutils     cmake     wget   172.1s
 => [build 5/9] RUN mkdir /home/ifm/ifm3d                                                                                                                               0.5s
 => [build 6/9] ADD /home/ifm/ifm3d                                       0.0s
 => [build 7/9] RUN cd /home/ifm/ifm3d &&    tar -xf ifm3d-ubuntu-22.04-arm64-debs_1.2.6.tar &&      dpkg -i *.deb                                                      2.1s
 => [build 8/9] RUN mkdir -p /home/ifm/colcon_ws/src &&     cd /home/ifm/colcon_ws/src &&     git clone -b lm_humble_tests --sin  4.2s
 => [build 9/9] RUN cd /home/ifm/colcon_ws &&     source /opt/ros/humble/setup.bash &&     colcon build --cmake-  242.8s
 => [stage-1 2/7] COPY --from=build /home/ifm/colcon_ws /home/ifm/colcon_ws                                                                                             0.1s
 => [stage-1 3/7] COPY --from=build /home/ifm/ifm3d/*.deb /home/ifm/ifm3d/                                                                                              0.0s
 => [stage-1 4/7] WORKDIR /home/ifm                                                                                                                                     0.0s
 => [stage-1 5/7] RUN apt-get update     && apt-get install -y --no-install-recommends     libxmlrpc-c++8v5     locales     sudo     libssl-dev     libgoogle-glog0v  238.2s
 => [stage-1 6/7] RUN cd /home/ifm/ifm3d &&    dpkg -i *.deb                                                                                                            2.1s
 => [stage-1 7/7] RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen &&     locale-gen en_US.UTF-8 &&     /usr/sbin/update-locale LANG=en_US.UTF-8                         7.1s
 => exporting to image                                                                                                                                                  3.3s
 => => exporting layers                                                                                                                                                 3.3s
 => => writing image sha256:c1d72f3316c084ee0bb759c9aa9bdfdd64bcdcff33a3011efeadcf6f38815160                                                                            0.0s
 => => naming to

Deploy the container

To deploy the container on to the VPU, or use the container locally to interact with the O3R platform, please refer to our docker documentation.

Distributed setup

It is possible to run a complete ROS system in a distributed way. In this section we provide instructions to run ifm3d-ros2 in a container deployed on the VPU (primary container), and the visualization locally on a laptop (secondary system). These instructions can be adapted to suit other architectural designs.

Primary docker container: ifm3d-ros2 node

  1. Build and deploy the docker container image to the VPU (see the documentation on how to deploy a container):

$ docker save | ssh -C oem@ docker load
  • SSH to the VPU and run the container:

$ ssh oem@ #Adapt to the IP address of your VPU
o3r-vpu-c0$ docker run -ti --net=host ifm3d-ros:humble-arm64_v8
  • Source ROS2 and the ìfm3d_ros2 installation:

root@952330b98eac:/home/ifm# source /opt/ros/humble/setup.bash && source colcon_ws/install/setup.bash
  • All ROS nodes should see each other as long as they are on the same ROS domain ID. The default ROS_DOMAIN_ID is 0 and doesn’t get changed here.

  • Run the ros2 node:

$ ros2 launch ifm3d_ros2


The command above uses the default configuration defined in the /config/camera_default_parameters.yaml file. You can adapt the parameters by using a different config file:

root@62b0c2e120bb:/home/ifm/$ ros2 launch ifm3d_ros2  parameter_file_directory:=config/examples parameter_file_name:=o3r_3d.yaml camera_name:=camera_3d

Second ROS2 client: plain ros2

  1. Source ROS2 on the secondary machine:

$ source /opt/ros/galactic/setup.bash
  • Check that ROS topics are available (on ROS_DOMAIN_ID=0):

$ ros2 topic list
  • Start the visualization and subscribe to the relevant topic:

$ rviz2


To use Rviz2 from a docker container, the container has to be started with a specific environment:

$ docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix --env=DISPLAY --env=QT_X11_NO_MITSHM=1 --net=host --privileged ros:humble-ros-core