2017-09-29 4 views
0

docker-compose v2を使用して2つのコンテナ間で1つのフォルダを共有するにはどうすればよいですか?docker-composeを使用して2つのコンテナ間でフォルダを共有

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 
+0

? –

+0

apiコンテナのログファイルは/ app/searcher/datavolumeにあり、このフォルダをfilebeatコンテナに共有したいとします。 – SerSergious

答えて

3
version: '2' 

volumes: 
    staticfiles: {} 

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

    nginx: 
    [...] 
    volumes: 
     - staticfiles:/app/server/staticfiles 
    [...] 
関連する問題