繁体   English   中英

使用docker-compose在两个容器之间共享文件夹

[英]Share folder between two containers using docker-compose

如何使用docker-compose v2在两个容器之间共享一个文件夹?

我正在尝试在2个容器之间共享文件,但是它不起作用。 我试过使用卷,但是也没有用。 有人对此有任何建议吗?

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
version: '2'

volumes:
  staticfiles: {}

services:
  django:
    [...]
    volumes:
      - staticfiles:/app/server/staticfiles
    [...]

  nginx:
    [...]
    volumes:
      - staticfiles:/app/server/staticfiles
    [...]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM