我的docker-compose.yml如下所示,我正在尝试关注docker注册文档here中的撰写文件。当我运行docker-compose时,我得到以下错误。
错误:在文件'./docker-compose.yml'中,服务'卷'必须是 映射不是数组。
registry:
restart: always
image: sudarshan/registry
ports:
- 5000:5000
environment:
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
REGISTRY_HTTP_TLS_KEY: /certs/domain.key
REGISTRY_AUTH: silly
REGISTRY_AUTH_SILLY_SERVICE: SILLY_SERVICE
REGISTRY_AUTH_SILLY_REALM: SILLY_REALM
volumes:
- /usr/certs:/certs
我的泊坞窗版本是
Docker版本1.12.1,版本23cf638
docker-compose版本是
docker-compose版本1.7.1,构建0a9ab35
在Ubuntu 16.04上运行
编辑:
也试过
registry:
restart: always
image: sudarshan/registry
ports:
- 5000:5000
environment:
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
REGISTRY_HTTP_TLS_KEY: /certs/domain.key
REGISTRY_AUTH: silly
REGISTRY_AUTH_SILLY_SERVICE: SILLY_SERVICE
REGISTRY_AUTH_SILLY_REALM: SILLY_REALM
volumes:
- /usr/certs:/certs
答案 0 :(得分:36)
问题是你没有正确缩进字段。您的docker-compose应如下所示:
registry:
restart: always
image: sudarshan/registry
ports:
- 5000:5000
environment:
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
REGISTRY_HTTP_TLS_KEY: /certs/domain.key
REGISTRY_AUTH: silly
REGISTRY_AUTH_SILLY_SERVICE: SILLY_SERVICE
REGISTRY_AUTH_SILLY_REALM: SILLY_REALM
volumes:
- /usr/certs:/certs
答案 1 :(得分:0)
我认为您必须做到:
version: '3'
services:
web:
stdin_open: true
environment:
- CHOKIDAR_USEPOLLING=true
build:
context: .
dockerfile: Dockerfile.dev
ports:
- '3000:3000'
volumes:
- /app/node_modules
- .:/app