Allow use of the Docker API as an alternative to the command line client

Added the ability to interact with the Docker server via the REST API (using [docker-java](https://github.com/docker-java/docker-java)) instead of the Docker command line client.  Useful for platforms where the Docker client is unavailable (aka Windows).

Use of the API is enabled through the `useApi` convention which defaults to FALSE (thus preserving the existing behavior).  This allows use in environments where the Docker server is not reachable via the API (the docker-java code doesn't support UD sockets yet).
This looks really weird to me and I'm hoping there is a better way.  However, after much hacking about I couldn't find one (though I a very much a Groovy/Gradle newbie).