Can I mount same volume to multiple docker containers

后端 未结 2 2086
一生所求
一生所求 2020-12-06 00:44

I need to share the application logs to mounted volume. I want to mount same volume to all docker containers to keep the logs. is it possible? will it effect the applicatio

相关标签:
2条回答
  • 2020-12-06 01:08

    Yes you can add same location as a volume to many docker containers.

    Additionally you can use --volumes-from to mount your log directory in one container not actually running any application and then use the volumes from this container in your other containers without having to repeat the paths everywhere.

    Worth a read Docker volumes

    0 讨论(0)
  • 2020-12-06 01:29

    I'm mounting the same directory to several containers but for read purpose, not write (if your logs are written within the containers. I think that if they are writing to different files it Should work..

    0 讨论(0)
提交回复
热议问题