本文介绍了Docker Compose中的无效类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Docker Compose中遇到错误。撰写文件为
I am facing error in Docker Compose. The compose file is
version: '2'
services:
api:
build:
context: .
dockerfile: webapi/dockerfile
ports:
- 210
web:
build:
context: .
dockerfile: app/dockerfile
ports:
- 80
lbapi:
image: dockercloud/haproxy
links:
– api
ports:
– 8080:210
lbweb:
image: dockercloud/haproxy
links:
– web
ports:
– 80:80
运行 docker-compose up时的错误
是:
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.lbapi.ports contains an invalid type, it should be an array
services.lbweb.ports contains an invalid type, it should be an array
services.lbapi.links contains an invalid type, it should be an array
services.lbweb.links contains an invalid type, it should be an array
请帮助。
- docker-compose版本1.8.0-rc1,构建9bf6bc6
- docker-py版本:1.8.1
- CPython版本:2.7.11
- OpenSSL版本:OpenSSL 1.0.2d 2015年7月9日
- docker-compose version 1.8.0-rc1, build 9bf6bc6
- docker-py version: 1.8.1
- CPython version: 2.7.11
- OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015
推荐答案
您是否尝试过:
version: '2'
services:
api:
build:
context: .
dockerfile: webapi/dockerfile
ports:
- 210
web:
build:
context: .
dockerfile: app/dockerfile
ports:
- 80
lbapi:
image: dockercloud/haproxy
links:
– api
ports:
– "8080:210"
lbweb:
image: dockercloud/haproxy
links:
– web
ports:
– "80:80"
这篇关于Docker Compose中的无效类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!