我有以下docker-compose.yml
文件:
version: '3'
services:
proxy-nginx:
build:./nginx
ports:
- 80:80
当我运行`docker-compose the console logs:
In file './docker-compose.yml', service 'proxy-nginx' must be a mapping not a string.
This answer建议在端口周围使用引号:
version: '3'
services:
proxy-nginx:
build:./nginx
ports:
- "80:80"
还尝试缩进端口:
version: '3'
services:
proxy-nginx:
build:./nginx
ports:
- 80:80
但是结果仍然相同。有什么想法吗?
答案 0 :(得分:2)
尝试正确缩进端口:
version: '3'
services:
gogs-nginx:
build: ./nginx
ports:
- "80:80"
我认为问题在于解析器认为 ports 是另一项服务,原因是误导性缩进。我不能为此怪。