j3soon / ros2-essentials

A repo containing essential ROS2 (Humble) features for controlling Autonomous Mobile Robots (AMRs).
Apache License 2.0
7 stars 3 forks source link

Docker Named Volumes for Caching #31

Closed j3soon closed 3 weeks ago

j3soon commented 2 months ago

I'm thinking of using docker named volumes for all caches as in: https://github.com/j3soon/omni-nerf-extension/blob/284cf5388b8c2c99f22bd3b49a45a892ba49bad0/compose.yaml#L76-L77

I wonder what's @YuZhong-Chen's thought on this. This allows not polluting our repo directory, while still allow caching between container launches.

However, I'm not sure if we should use the same named volume across all workspaces, or using a named volume for each workspace.

Although sharing the named volume seems a bit dirty (each workspaces cache are not isolated), I think its pros outweigh the cons.

YuZhong-Chen commented 2 months ago

First, we may need to identify which caches are intended to be stored in the Docker Volume.

For directories like install, build, and log, generated by ros2, it's not suitable to share a single Docker volume. As for whether to place them in each Docker volume or the current repo directory, I believe both options are viable with their advantages. However, I prefer to maintain the current approach because it makes it easier to transfer executables or delete entire directories for colcon to recompile the workspace.

As for whether to place the cache of Isaac Sim or Gazebo in a Docker volume, I agree with moving them out of the repo directory and into a shared Docker volume. While sharing the same volume may lead to potential clutter, the benefits of this choice indeed outweigh the drawbacks.