更改docker-compose传播设置

时间:2019-02-26 18:31:11

标签: docker

我试图更改docker compose的传播设置。以下是我的yaml文件。

version: '3.2'
services:
  web:
    build:
      context: .
      dockerfile: Dockerfile.dev
    ports:
      - "3000:3000"
    volumes:
      - /app/node_modules
      - type: bind
        source: .
        target: /app
        bind:
          propagation: shared

但是,当我对容器进行docker检查时,该卷仍处于私有状态。

"Mounts": [
            {
                "Type": "bind",
                "Source": "/c/users/pinku/Desktop/workflow/frontend",
                "Destination": "/app",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "volume",
                "Name": "9a085880e8938e31a5b8d4a66b53700b26d3b279799d614a26e82134dd0f58d5",
                "Source": "/mnt/sda1/var/lib/docker/volumes/9a085880e8938e31a5b8d4a66b53700b26d3b279799d614a26e82134dd0f58d5/_data",
                "Destination": "/app/node_modules",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ]

关于我在做什么错的任何想法吗?

1 个答案:

答案 0 :(得分:3)

有很多相关的GitHub问题:https://github.com/docker/compose/issues/5212https://github.com/moby/moby/issues/34936

尝试更新docker-compose安装(1.21+),并将version指令的值更改为至少版本“ 3.3”。