ROS2 logging to docker daemon

Hi,

I am running a ros2 node (humble) inside a container (with entry point ros2 run …) and the container is read only mode (because of some security reasons and 3rd party provider). so it can’t or should not able to create any folders inside the containers. But ros2 logging requires it to create a folder in home directory or a logging folder some where.

I was thinking more of a scenario where the ros2 logs only to stdout and doesn’t create any folders on the home directory and does does the logging inside the container (since the container is read only). ros2 should output logs only to stdout. And the docker engine takes care of storing them in docker logs or may be forward them systemd based on docker configuration.

Is it possible to restrict ros2 logging only to standard out in the current ros2 versions or in the future ?
The same question is posted here as well

1 Like

There’s an open issue about this here: Configure logging to not write to file system · Issue #88 · ros2/rcl_logging · GitHub

Do you have a writable /tmp directory? If so you might be able to set the ROS_HOME environment variable to /tmp. If building ROS 2 from source is an option then you could use a different logging implementation, like rcl_logging_rcutils.

Thanks sloretz

Thanks for the link, I missed the previous discussion. Yes,Currently we had a work around by mounting a folder to /tmp dir. But it didn’t appear elegant.

And Yes, we are building ros2 from source. So I will give it a try using rcl_logging_rcutils.