How to make different docker-compose mount volumes when has replicas?

Viewed 25

I have compose file with two dependent services and all works fine. But one has mount volume as

volumes:
  - "/web/logs:/usr/src/app/log"

and

deploy:
   mode: replicated
   replicas: 8 # may be different

Thus all replicas use one directory and file name. It is possible to write into different directory or files?

1 Answers

you can add an extra folder under /log,use some variable for the folder name eg: ip address so it will be unique and can do it automatic.

Related