# ROS2 logging to docker daemon

**URL:** <https://discourse.openrobotics.org/t/ros2-logging-to-docker-daemon/26563>\
**Category:** ROS General\
**Tags:** ros2\
**Created:** [July 21, 2022, 8:39am UTC](https://discourse.openrobotics.org/t/ros2-logging-to-docker-daemon/26563 "2022-07-21T08:39:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhanu\_kiran\_chaluvad](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/bhanu_kiran_chaluvad/32/5138_2.png) [@bhanu\_kiran\_chaluvad](https://discourse.openrobotics.org/u/bhanu_kiran_chaluvad)\
**Post date:** [July 21, 2022, 8:39am UTC](https://discourse.openrobotics.org/t/ros2-logging-to-docker-daemon/26563/1 "2022-07-21T08:39:35Z")

</div>

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](https://docs.ros.org/en/foxy/Tutorials/Logging-and-logger-configuration.html#logging-directory-configuration) 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](https://answers.ros.org/question/401854/ros2-logging-to-daemond/) as well

---

<div class="post-metadata">

**Author:** ![sloretz](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/sloretz/32/23113_2.png) [@sloretz](https://discourse.openrobotics.org/u/sloretz)\
**Post date:** [July 21, 2022, 8:30pm UTC](https://discourse.openrobotics.org/t/ros2-logging-to-docker-daemon/26563/2 "2022-07-21T20:30:18Z")

</div>

There’s an open issue about this here: [Configure logging to not write to file system · Issue #88 · ros2/rcl\_logging · GitHub](https://github.com/ros2/rcl_logging/issues/88)

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](https://github.com/sloretz/rcl_logging_rcutils).

---

<div class="post-metadata">

**Author:** ![bhanu\_kiran\_chaluvad](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/bhanu_kiran_chaluvad/32/5138_2.png) [@bhanu\_kiran\_chaluvad](https://discourse.openrobotics.org/u/bhanu_kiran_chaluvad)\
**Post date:** [July 22, 2022, 8:08am UTC](https://discourse.openrobotics.org/t/ros2-logging-to-docker-daemon/26563/3 "2022-07-22T08:08:41Z")

</div>

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](https://github.com/sloretz/rcl_logging_rcutils).
