How to initialize a named volume shared across several containers with docker-compose How to initialize a named volume shared across several containers with docker-compose wordpress wordpress

How to initialize a named volume shared across several containers with docker-compose


Here is what I could find as an answer:

Which service will copy its data to the named volume first ?

The container that starts first (thanks to volumes-from, depends-on, ...)

Does the second container will overwrite the data put by the first one?

No, once a named volume has been "initialized" (means no empty anymore), it will overwrite every mount point where it 's attached to.

How to "initialize" the named volume somewhere and just use it (after) the 2 containers where its mounted ? I heard about a "nocopy" flag.

There is indeed a "nocopy" flag, like in the "docker run" documentation, BUT doesn't seem to work with other flag ("ro" or "rw").

Am I obliged to use other stuff (like data container) instead of named volume ?

Therefore, no.