2016-06-22 133 views
3

我在Docker Compose中遇到错误。撰写文件Docker Compose中的类型错误无效

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 

请帮助。

  • 搬运工-撰写版本1.8.0-RC1,建立9bf6bc6
  • 搬运工吡版本:1.8.1
  • CPython的版本:2.7.11
  • OpenSSL的版本:OpenSSL的1.0.2d 7月9日2015年

回答

5

你尝试:

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"