How to properly share cargo registry with docker containers?

⚓ rust    📅 2025-05-13    👤 surdeus    👁️ 2      

surdeus

I'd like to share a project repo with a container via a local volume in order to build and run code in it. And I'd like to share cargo's dependency cache, otherwise deps will be redownloaded and rebuilt quite a lot.

Is it ok to share ~/.cargo/registry for this?

And should I share anything else?

services:
  app:
    volumes:
      - ~/repo:/home/appuser/repo
      - ~/.cargo/registry:/home/appuser/.cargo/registry

4 posts - 3 participants

Read full topic

🏷️ rust_feed