Interview Prep/Docker/Volumes, storage and data

Two containers must share files. What are your options?

BeginnerScenarioVolumes, storage and data
Answer

Situation read → Typical for a web server serving files generated by an app.

What I'd do →

  1. A shared named volume mounted in both (-v assets:/srv/assets, read-only in the consumer).
  2. --volumes-from producer for a quick link.
  3. For cross-host, NFS volume driver or object storage instead.

Why → Volumes avoid host path dependency; use :ro where possible.

Interview tip → Concurrent writers need app-level locking; Docker does not provide it.

All Docker questions Roadmap: Docker & containers

More on Volumes, storage and data