0

我对 Docker 很陌生,我对如何做到这一点有点迷茫。

我正在尝试将旧的 Windows 服务转换为 Docker。它依赖于一个包含大量数据的目录来运行。我有解决方案构建和正在创建的容器,但没有文件夹它就无法运行。如何添加此文件夹?它将是只读的。

我已经阅读过,似乎我想通过 Docker Compose 安装它。我尝试了如下的长版本。

version: '3.4'

services:
  AddressCorrectionService:
    image: pathtocompanydockerstore/addresscorrectionservice
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - type: volume
        source: c:/smartms
        target: /smartms
        volume:
          nocopy: true

volumes:
    smartms:

我收到以下错误:

命名卷“{'type': 'volume', 'source': 'c:\smartms', 'target': '/smartms', 'volume': {'nocopy': True}}”用于服务“ AddressCorrectionService”,但在卷部分未找到声明。

我看到了这篇文章,但我不记得输入凭据或不知道如何重置 Docker。

4

1 回答 1

1

在您在问题中链接到的帖子中,答案的作者将安装类型从更改volumebind

volumes:
  - type: bind

所以在你的文件中,试试这个怎么样:

version: '3.4'

services:
  AddressCorrectionService:
    image: pathtocompanydockerstore/addresscorrectionservice
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - type: bind
        source: c:/smartms
        target: /smartms
        volume:
          nocopy: true
于 2018-07-13T02:38:18.447 回答