Docker-Compose won't launch ros node, but Docker run will
I'm having a strange issue running a ROS Melodic node inside a Docker container.
Within the container I want to launch row_follower.launch
inside the navvy_row
package. If I run the container with a command argument, docker run --rm -it --net host navvy_row roslaunch navvy_row row_follower.launch
, the node starts without issue:
... logging to /root/.ros/log/a5064c4a-e3e2-11eb-b627-48b02d0788d9/roslaunch-nanoboi-235.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://nanoboi:45713/
SUMMARY
========
PARAMETERS
* /ransac_row_followerv2/LeftRightThreshold: 0.8
* /ransac_row_followerv2/PPMultiplier: 5
...
However if I try the same using docker-compose
and the below entry:
navvy_row:
container_name: navvy_row
image: navvy_row
build: navvy_row/
network_mode: host
command: roslaunch navvy_row row_follower.launch
I get no output past the echo from /ros_entrypoint.sh. I know the workspace is sourced correctly because replacing the command: with rospack find navvy_row
returns the location as expected.
Attaching to the container and launching the launchfile starts as expected, but then the original docker-compose logs show an error because two nodes were registered with the same name, starts loading the new node and then the whole container exits.
navvy_row | [ WARN] [1626185169.544579230]: Shutdown request received.
navvy_row | [ WARN] [1626185169.544793054]: Reason given for shutdown: [[/ransac_row_followerv2] Reason: new node registered with same name]
navvy_row | [ INFO] [1626185126.115699876]: Starting ransac row node
navvy_row | [ INFO] [1626185126.259093209]: Finished Setup, Starting Spinning
...
If I don't start roscore
on the host before trying to launch the container, if it's the only container the same thing happens (nothing).
If I have another ros1 container running it seems to sometimes get further but always results in an error from one of the containers:
RLException: run_id on parameter server does not match declared run_id: 13e8b156-e3e4-11eb-b345-48b02d0788d9 vs 13e26936-e3e4-11eb-8394-48b02d0788d9
I've run out of ideas on how to fix this, any help much appreciated!
I'm afraid there are things you haven't described about your environment. First sharing the content of
.launch
file helps.What is this? Is running
roscore
aside from thedocker-compose
process in question a requirement?This is the contents of the .launch file:
I'm not sure I fully understand your question about roscore on the host. I could have roscore running in its own container instead of on the host, either way I wanted a consistent location for the various ros1 containers and ros1-bridge to access.
I'm not sure what else I can provide, but please let me know and I will do my best!