Closed cardboardcode closed 8 months ago
This attempt utilizes the built-in network domain feature in ROS 2 to help talker
node in Container communicate with listener
node in Host.
Issue persists. :cry: :red_circle:. talker
in Container still unable to send messages outside to listener
on Host.
cd $HOME
git clone https://github.com/Tiryoh/docker-ros2-desktop-vnc.git --depth 1 --single-branch
tiryoh/ros2-desktop-vnc:humble-amd64
docker image:cd $HOME
cd docker-ros2-desktop-vnc/humble
docker buildx build --platform=linux/amd64 --progress=plain -t tiryoh/ros2-desktop-vnc:humble-amd64 .
docker run -p 6080:80 --security-opt seccomp=unconfined --shm-size=512m tiryoh/ros2-desktop-vnc:humble-amd64
# Open new terminal
hostname -i
You should see something like 192.168.0.167
.
# Open new terminal
hostname -i
You should see something like 192.168.0.163
.
Container :whale2:
# In VNC Container terminal
ping <ip_address_of_host>
# Eg. ping 192.168.0.163
Host :computer:
# In Host terminal
ping <ip_address_of_container>
# Eg. ping 192.168.0.167
You should see that both commands are producing successful pings to show both Host and Container are connected.
ROS_DOMAIN_ID
to the same one on Host as on Container and run the respective talker
and listener
nodes:Container :whale2:
# In VNC Container terminal
export ROS_DOMAIN_ID=5
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker
Host :computer:
# In Host terminal
export ROS_DOMAIN_ID=5
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp listener
This attempt runs the docker Container in network_mode:host in order to allow talker
node in Container communicate with listener
node in Host.
Issue is resolved. talker
in Container is able to send messages outside to listener
on Host.
cd $HOME
git clone https://github.com/Tiryoh/docker-ros2-desktop-vnc.git --depth 1 --single-branch
humble/entrypoint.sh
as follows:if [ $(uname -m) = "aarch64" ]; then
LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver :5 -geometry 1920x1080 -depth 24 -fg
else
vncserver :5 -geometry 1920x1080 -depth 24 -fg
fi
humble/entrypoint.sh
to the following:command=gosu '$USER' bash -c "websockify --web=/usr/lib/novnc 6080 localhost:5905"
tiryoh/ros2-desktop-vnc:humble-amd64
docker image:cd $HOME
cd docker-ros2-desktop-vnc/humble
docker buildx build --platform=linux/amd64 --progress=plain -t tiryoh/ros2-desktop-vnc:humble-amd64 .
docker run --ipc host --net host -p 6080:80 --security-opt seccomp=unconfined --shm-size=512m tiryoh/ros2-desktop-vnc:humble-amd64
talker
and listener
nodes in Container and Host respectively:Container :whale2:
# In VNC Container terminal
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker
Host :computer:
# In Host terminal
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp listener
I was dumb. Forgot to do docker run
with --ipc host
as well as --net host
parameter flag.
As a quick add-on, while this issue has been resolved, it would be helpful if an investigation be made on how docker container latency may affect the rate at which messages are published from within Container and received in Host.
:blush: Once again, thank you for the help in a previous issue @Tiryoh.
This repository has been very helpful thus far, particularly for those getting started with ROS 2 in general and do not want to worry about dependency conflict and environmental setup.
Issue Description
Attempting to run the docker Container does not allow ROS 2 nodes to communicate outside of it on the Host.
The reason why this could be important for it to be able to do so is such that ROS 2 systems developed within the Container can interact and thus integrate better with ROS 2 systems running outside of it.
Steps To Reproduce :hammer:
1. Download repository:
2. Build
tiryoh/ros2-desktop-vnc:humble-amd64
docker image:3. Build docker container:
4. Access the docker VNC Container:
Open your preferred browser and go to http://127.0.0.1:6080/
5. Within the VNC Container, run
demo_node_cpp
'stalker
node:5. On Host, run
demo_node_cpp
'slistener
node:Expected Behaviour :green_circle:
While the
talker
ROS 2 node produces the following output in Container:The
listener
ROS 2 node in Host should output the following similar output:Actual Behaviour :red_circle:
While the
talker
ROS 2 node produces the following output in Container:Running
ros2 run demo_nodes_cpp listener
in Host does not output anything.Remarks :speech_balloon:
Will be updating below shortly with my own attempts to debug the issue. I am aware of the changes suggested in Issue #138. However, implementing them only resolved the issue partially as you will see below in my various attempts.
I believe, by resolving this issue, it could make it even easier to develop ROS 2 applications for many users since many developers prefer a GUI-based workflow, similar to what is achieved in this repository.
Appreciate any help on this issue. Thank you :pray: