version: '2'
services:
  web:
    build: .
    ports:
    - "8080:8080"
    links:
    - postgres-db
    environment:
    - 'SPRING_APPLICATION_JSON={"spring":{"profiles": {"active": "dev"}, "datasource":{"username": "postgres", "url": "jdbc:postgresql://postgres-db:5432/postgres"}}}'
  postgres-db:
    image: postgres:9.4
    expose:
    - "5432"
    volumes:
    - postgres-data:/var/lib/postgresql/data
volumes:
  postgres-data: {}

version: '2'
services:
  web:
    build: .
    ports:
    - "8080:8080"
    links:
    - postgres-db
    environment:
    - 'SPRING_APPLICATION_JSON={"spring":{"profiles": {"active": "dev"}, "datasource":{"username": "postgres", "url": "jdbc:postgresql://postgres-db:5432/postgres"}}}'
  postgres-db:
    image: registry.opensource.zalan.do/stups/postgres:9.4.5-1
    expose:
    - "5432"
    volumes:
    - postgres-data:/var/lib/postgresql/data
volumes:
  postgres-data: {}

Use postgres image from pierone
Use postgres image from pierone
