server:
  build: .
  command: server -automigrate=true
  links:
    - db:db
  ports:
    - "8080:8080"
  volumes:
    - ~/.dockercfg:/root/.dockercfg
    - "/var/run/docker.sock:/var/run/docker.sock"
  env_file: .env
  user: root
  environment:
    EMPIRE_DATABASE_URL: postgres://postgres:postgres@db/postgres?sslmode=disable
    DOCKER_HOST: unix:///var/run/docker.sock
    EMPIRE_SCHEDULER: cloudformation-migration
    EMPIRE_X_SHOW_ATTACHED: 'true'
db:
  image: postgres
  ports:
    - "5432:5432"

server:
  build: .
  command: server -automigrate=true
  links:
    - db:db
  ports:
    - "8080:8080"
  volumes:
    - ~/.dockercfg:/root/.dockercfg
    - "/var/run/docker.sock:/var/run/docker.sock"
  env_file: .env
  user: root
  environment:
    EMPIRE_DATABASE_URL: postgres://postgres:postgres@db/postgres?sslmode=disable
    DOCKER_HOST: unix:///var/run/docker.sock
    EMPIRE_SCHEDULER: cloudformation-migration
    EMPIRE_X_SHOW_ATTACHED: 'true'
db:
  image: postgres

Remove postgres port, because it errors if postgres is already running on the machine.
Remove postgres port, because it errors if postgres is already running on the machine.