I am having problem sharing a folder between Docker containers running on different nodes of Docker Swarm. My swarm consist of one manager and two workers.
I am using this compose 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 is successfully mounted in both containers with use of docker exec _id_ ls /test
. But when I add a file into this folder with docker exec _id_ touch /test/file
second container does not see created file.
How to configure the swarm so the files are visible in both containers?