Docker - Package not found even after source
I'm trying to launch rosbridge_server
inside docker.
This is my docker file:
FROM ros:noetic
RUN apt-get update && apt-get install -y \
ros-noetic-rosbridge-server \
ros-noetic-gps-common
RUN apt-get update && \
rosdep update
RUN apt-get update && apt-get install -y \
lsof \
python3-pip \
ros-noetic-catkin
ADD ./my_workspace /my_workspace
RUN /bin/bash -c 'source /opt/ros/noetic/setup.bash; \
cd /my_workspace; catkin_make; \
source /my_workspace/devel/setup.bash; \
rospack find my_package' #"rospack find" successfully prints my package's path.
#No problem here
#RUN rospack find my_package #Here is the problem.
#If I uncomment this, I get an error that rospack is not found.
#It's like nor the source command or my package
#exist outside the previous RUN command
CMD ["./launch_ros_bridge.bash"] #Ros bridge is started but once
#I subscribe to a topic of my package,
#it prints an error that "my_package" is not found
This is my launch_ros_bridge.bash
script:
#!/bin/bash
roslaunch rosbridge_server rosbridge_websocket.launch
The error I receive when launch_ros_bridge.bash
is executed, is
[-] [ERROR] [1624456872.953620]: [Client 0] advertise: Unable to import my_package.msg from package my_package. Caused by: No module named 'my_package'. [-] ROS path [0]=/opt/ros/noetic/share/ros [-] ROS path [1]=/opt/ros/noetic/share
Again, my package's path is not displayed.
My question is how can I successfully start and subscribe to ros bridge server
inside a docker?