Reputation: 490
How to share one folder between two containers using docker-compose v2?
I am trying to share a file between 2 containers, but it doesn't work. I have tried using volumes but it didn't worked also. Does anyone have any suggestions on how to do this?
api:
build:
context: searcher/
dockerfile: Dockerfile
ports:
- "8080:8080"
volumes:
- ./searcher/datavolume:/datavolume
filebeat:
build: filebeat/
volumes_from:
- api-endpoint:ro
volumes:
- ${PWD}/filebeat/filebeat.yml:/filebeat.yml
Upvotes: 3
Views: 2418
Reputation: 5205
version: '2'
volumes:
staticfiles: {}
services:
django:
[...]
volumes:
- staticfiles:/app/server/staticfiles
[...]
nginx:
[...]
volumes:
- staticfiles:/app/server/staticfiles
[...]
Upvotes: 6