我想运行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。
答案 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)
您正在执行以下操作:
.
。即
volumes:
- '/c/Users/cerdem/Desktop/eventstore:./data'
- '/c/Users/cerdem/Desktop/eventstore:./logs'
顺便说一句,如果您感兴趣的话,我编写了一个方便的小脚本来简化Windows-2-Docker频繁路径转换的工作。