这是我的docker-compose.yaml
version: '2'
services:
databases:
image: mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=user
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=demodb
web:
image: nginx
错误:The Compose file ./docker-compose.yml' is invalid because:
Additional properties are not allowed('web' was unexpected)
在底部,它说这可能是因为docker-compose版本,但是在docker网站上它说窗户上的docker带有docker-compose而且不需要单独安装。 / p>
答案 0 :(得分:1)
问题是web
的缩进,请将其与databases
服务的级别对齐,如下所示。然后我设法运行docker-compose up
version: '2'
services:
databases:
image: mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=user
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=demodb
web:
image: nginx