To build:
docker build -rm -t docker-gradle .
To run:
docker run -rm -v $PWD:/opt/gradle -i -t docker-gradle tasks
docker run -rm -v $PWD:/opt/gradle -i -t docker-gradle test
docker run -rm -v $PWD:/opt/gradle -i -t docker-gradle build
This will run Gradle tasks against an example Gradle + Groovy project in a Docker container.