Since docker-compose service can be scaled, it would be useful to export to each container the replica ordinal index as some environment variable or the contents of some system file. This index can be used, for example, to create replicas own subdirectories if all replicas use the same host path as bind mounts.