Invalid type error in Docker Compose

Did you try with quotes on ports?

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"

You should surround ports with quotation marks("8080:210") because docker-compose expecting string or number in "ports" array but 8080:210 is not really either of them. See https://docs.docker.com/compose/compose-file/#ports


For anyone ending up on this page - as it for now is the top search result on google - please check your syntax. It's mostly because of missing indent, double quotation marks, missing space, etc.

For reference in regards to an example of correct syntax, check the documentation from docker: https://docs.docker.com/compose/compose-file/