What's wrong with the following spec? (Image parameter is here to tag resulting image).
version: '3'
services:
foo:
build:
image: foo/bar
dockerfile: Dockerfile
context: .
System output:
services.foo.build contains unsupported option: 'image'
Versions: docker-compose: 1.14.0; Docker: 17.06.0-ce