0

i have the next problem:

i try to build a docker image with ros2, in which a code package is downloaded which will be built using the colcon build method.

but when I try to run last of. install / setup.bash doesn't work for me.

I already tried to put it in a script and copy it to the dockerfile but it didn't work

any ideas

here I leave the docker file

FROM osrf/ros:dashing-desktop

WORKDIR /home

COPY mobilidad.sh .
RUN bash mobilidad.sh


ENV ROS2_WS cleanmyway/test_ws
RUN mkdir -p ${ROS2_WS}/src/demo_py
COPY ./ ${ROS2_WS}/src/demo_py

WORKDIR ${ROS2_WS}

SHELL ["/bin/bash", "-c"]
RUN colcon build
RUN . install/setup.bash

note: mobilidad.sh is a script that dowload de code from github, this works fine

1 Answers1

0

I think I managed to find a solution,

building the dockerfile as follows:

FROM osrf/ros:dashing-desktop
WORKDIR /home
COPY mobilidad.sh . 
RUN bash mobilidad.sh

ENV ROS2_WS cleanmyway/test_ws
RUN mkdir -p ${ROS2_WS}

WORKDIR ${ROS2_WS}

RUN colcon build
RUN echo "source install/setup.bash" >> /opt/ros/dashing/setup.bash

and when i run the ros2 command works fine

but anyway thanks for the help. :) note: i'm not sure if the better form but works for me