Docker撰写/无效,因为

时间:2020-01-11 13:45:24

标签: docker docker-compose restore eventstoredb

我想运行docker-compose.yaml文件,但出现以下错误:

”无效,因为: services.eventstore.volumes包含无效的类型,应为数组”。

我将eventstore文件备份到我的Windows桌面上,我想使用docker恢复该文件。

这是我的docker-compose文件:

version: '3'
services:
  eventstore:
    image: eventstore/eventstore:release-5.0.1
    container_name: eventstore
    ports:
      - 2113:2113
      - 1113:1113
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "curl -sf http://localhost:2113/stats || exit 1"]
      interval: 5s
      timeout: 2s
    environment:
      - EVENTSTORE_RUN_PROJECTIONS=all
      - EVENTSTORE_START_STANDARD_PROJECTIONS=TRUE
    volumes:
      -C:/Users/cerdem/Desktop/eventstore:./data
      -C:/Users/cerdem/Desktop/eventstore:./logs

有关更多信息,我在放置volumes部分后遇到了错误,因为我听不懂那部分,因此我将从local而不是host恢复数据库文件

我的计算机正在运行Windows 1O。

2 个答案:

答案 0 :(得分:1)

在音量键中的破折号后需要空格。

    volumes:
      - C:/Users/cerdem/Desktop/eventstore:./data
      - C:/Users/cerdem/Desktop/eventstore:./logs

它不被识别为数组。因此,类型错误。

“无效,因为:services.eventstore.volumes包含无效类型,它应该是数组”

这是完整版本:

services:
  eventstore:
    image: eventstore/eventstore:release-5.0.1
    container_name: eventstore
    ports:
      - 2113:2113
      - 1113:1113
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "curl -sf http://localhost:2113/stats || exit 1"]
      interval: 5s
      timeout: 2s
    environment:
      - EVENTSTORE_RUN_PROJECTIONS=all
      - EVENTSTORE_START_STANDARD_PROJECTIONS=TRUE
    volumes:
      - C:/Users/cerdem/Desktop/eventstore:./data
      - C:/Users/cerdem/Desktop/eventstore:./logs

答案 1 :(得分:1)

您正在执行以下操作:

  • 破折号后需要一个空格。
  • 您应使用“奇怪的”字符来包装路径,例如用引号中的.
  • 您需要以Docker喜欢的方式格式化Windows路径。

    volumes:
      - '/c/Users/cerdem/Desktop/eventstore:./data'
      - '/c/Users/cerdem/Desktop/eventstore:./logs'

顺便说一句,如果您感兴趣的话,我编写了一个方便的小脚本来简化Windows-2-Docker频繁路径转换的工作。

https://stackoverflow.com/a/54619756/553663