I am having a problem sharing folders between Docker containers running on different Docker Swarm nodes. My swarm consists of one manager and two workers.
I use this build file to deploy applications:
version: '3' services: redis: image: redis:latest networks: - default ports: - 6379:6379 volumes: - test-volume:/test deploy: replicas: 1 update_config: parallelism: 2 delay: 10s restart_policy: condition: on-failure placement: constraints: [node.role == manager] logstash: image: docker.elastic.co/logstash/logstash:5.2.2 networks: - default volumes: - test-volume:/test deploy: placement: constraints: [node.role == worker] networks: default: external: false volumes: test-volume:
I can confirm that the folder was mounted successfully in both containers using docker exec _id_ ls /test . But when I add the file to this folder with docker exec _id_ touch /test/file , the second container does not see the created file.
How to configure a swarm so that files appear in both containers?
source share