<commit_before>Gradle Docker plugin
====================

image:https://d3oypxn00j2a10.cloudfront.net/0.12.6/img/nav/docker-logo-loggedout.png[Docker Logo]

Gradle plugin for managing link:https://www.docker.io/[Docker] images and containers using via its
link:http://docs.docker.io/reference/api/docker_remote_api/[remote API]. The heavy lifting of communicating with the
Docker remote API is handled by the link:https://github.com/docker-java/docker-java[Docker Java library]. Currently,
version 0.10.4 is used which assumes Docker's client API v1.15.

link:https://snap-ci.com/bmuschko/gradle-docker-plugin/branch/master[image:https://snap-ci.com/bmuschko/gradle-docker-plugin/branch/master/build_image[Build Image]]

== Usage

To use the plugin, include in your build script:

[source,groovy]
----
buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.bmuschko:gradle-docker-plugin:0.8.2'
    }
}
----


== Provided plugins

The JAR file comes with two plugins:

[options="header"]
|=======
|Plugin Identifier                    |Applies                        |Type                                                                                                                                                        |Description
|com.bmuschko.docker-remote-api       |-                              |link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/DockerRemoteApiPlugin.html[DockerRemoteApiPlugin]             |Provides custom tasks for interacting with Docker via its remote API.
|com.bmuschko.docker-java-application |com.bmuschko.docker-remote-api |link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/DockerJavaApplicationPlugin.html[DockerJavaApplicationPlugin] |Creates and pushes a Docker image for a Java application.
|=======

== Remote API plugin

The plugin `com.bmuschko.docker-remote-api` allows for interacting with Docker via its remote API. You can model any workflow
imaginable by creating enhanced task of the custom task provided by the plugin. To use the plugin, include the following
code snippet in your build script:

[source,groovy]
----
apply plugin: 'com.bmuschko.docker-remote-api'
----


=== Custom task types

==== Misc

The plugin provides the following general-purpose custom task types:

[options="header"]
|=======
|Type                                                                                                                                  |Description
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/DockerInfo.html[DockerInfo]       |Displays system-wide information.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/DockerVersion.html[DockerVersion] |Show the docker version information.
|=======


==== Images

The plugin provides the following custom task types for managing images:

[options="header"]
|=======
|Type                                                                                                                                                  |Description
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/Dockerfile.html[Dockerfile]                 |Creates a Dockerfile based on the provided instructions.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerBuildImage.html[DockerBuildImage]     |Builds an image from a Dockerfile.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerCommitImage.html[DockerCommitImage]   |Creates a new image from a container's changes.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerInspectImage.html[DockerInspectImage] |Returns low-level information on the image.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerListImages.html[DockerListImages]     |Lists images in registry.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerPullImage.html[DockerPullImage]       |Pulls an image from the registry.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerPushImage.html[DockerPushImage]       |Pushes an image to a registry.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerRemoveImage.html[DockerRemoveImage]   |Removes an image from the filesystem.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerTagImage.html[DockerTagImage]         |Tags an image in registry.
|=======


==== Containers

The plugin provides the following custom task types for managing containers:

[options="header"]
|=======
|Type                                                                                                                                                              |Description
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerCreateContainer.html[DockerCreateContainer]   |Creates a container.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerKillContainer.html[DockerKillContainer]       |Kills the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerRemoveContainer.html[DockerRemoveContainer]   |Removes the container for a given id from the filesystem.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerRestartContainer.html[DockerRestartContainer] |Restarts the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerStartContainer.html[DockerStartContainer]     |Starts the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerStopContainer.html[DockerStopContainer]       |Stops the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerWaitContainer.html[DockerWaitContainer]       |Blocks until container for a given id stops, then returns the exit code.
|=======


=== Extension properties

The plugin defines the following extension properties in the `docker` closure:

[options="header"]
|=======
|Property name   |Type      |Default value            |Description
|`url`           |String    |http://localhost:2375    |The server URL to connect to via Docker's remote API.
|`certPath`      |File      |null                     |The path to certificates for communicating with link:https://docs.docker.com/articles/https/[Docker over SSL].
|=======

For pushing an image to the Docker Hub registry or to a self-hosted one, you will also need to provide credentials in
the `registry` closure:

[options="header"]
|=======
|Property name   |Type      |Default value               |Description
|`url`           |String    |https://index.docker.io/v1  |The registry URL.
|`username`      |String    |null                        |The registry username.
|`password`      |String    |null                        |The registry password.
|`email`         |String    |null                        |The registry email address.
|=======


==== Extension examples

===== Working with a TLS-enabled Docker instance

Starting with Docker version 1.3, TLS is enabled by default. Please consult the Docker documentation link:https://docs.docker.com/articles/https/["Running Docker
with https"] to set up your certificate. The following example demonstrates how to configure the plugin to use those certifactes.
Additionally, this code snippet shows how to set the user credentials.

[source,groovy]
----
docker {
    url = 'https://192.168.59.103:2376'
    certPath = new File(System.properties['user.home'], '.boot2docker/certs/boot2docker-vm')

    registry {
        url = 'https://index.docker.io/v1'
        username = 'bmuschko'
        password = '<PASSWORD>'
        email = '<EMAIL>'
    }
}
----

===== Working with a Docker instance without TLS

The following example assumes that you disabled TLS on your Docker instance. You can do so by setting `DOCKER_TLS=no` in the file
 `/var/lib/boot2docker/profile`. Additionally, this code snippet shows how to set the user credentials.

[source,groovy]
----
docker {
    url = 'http://192.168.59.103:2375'
}
----

=== Usage examples

The following usage examples demonstrate code for common use cases. More scenarios can be found in the link:https://github.com/bmuschko/gradle-docker-plugin/blob/master/src/integTest/groovy/com/bmuschko/gradle/docker/DockerWorkflowIntegrationTest.groovy[integration tests].

==== Creating a Dockerfile and building an image

A Dockerfile can be created by the `Dockerfile` custom tasks. The Dockerfile instructions need to be declare in the correct
order.

[source,groovy]
----
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage

task createDockerfile(type: Dockerfile) {
    destFile = project.file('build/mydockerfile/Dockerfile')
    from 'ubuntu:12.04'
    maintainer '<NAME> "<EMAIL>"'
}

task buildImage(type: DockerBuildImage) {
    dependsOn createDockerfile
    inputDir = createDockerfile.destFile.parentFile
    tag = 'bmuschko/myimage'
}
----

==== Executing functional tests against a running container

The following example code demonstrates how to build a Docker image from a Dockerfile, starts up a container for this
image and exercises functional tests agains the running container. At the end of this operation, the container is stopped.

[source,groovy]
----
import com.bmuschko.gradle.docker.tasks.container.*
import com.bmuschko.gradle.docker.tasks.image.*

task buildMyAppImage(type: DockerBuildImage) {
    inputDir = file('docker/myapp')
    tag = 'test/myapp'
}

task createMyAppContainer(type: DockerCreateContainer) {
    dependsOn buildMyAppImage
    targetImageId { buildMyAppImage.getImageId() }
}

task startMyAppContainer(type: DockerStartContainer) {
    dependsOn createMyAppContainer
    targetContainerId { createMyAppContainer.getContainerId() }
}

task stopMyAppContainer(type: DockerStopContainer) {
    targetContainerId { createMyAppContainer.getContainerId() }
}

task functionalTestMyApp(type: Test) {
    dependsOn startMyAppContainer
    finalizedBy stopMyAppContainer
}
----


== Java application plugin

The plugin `com.bmuschko.docker-java-application` is a highly opinonated plugin for projects applying the link:http://www.gradle.org/docs/current/userguide/application_plugin.html[application plugin].
Under the covers the plugin preconfigures tasks for creating and pushing Docker images for your Java application. The default
configuration is tweakable via an exposed extension. To use the plugin, include the following code snippet in your build script:

[source,groovy]
----
apply plugin: 'com.bmuschko.docker-java-application'
----


=== Extension properties

The plugin defines the following extension properties in the `javaApplication` closure:

[options="header"]
|=======
|Property name   |Type      |Default value                        |Description
|`baseImage`     |String    |java                                 |The Docker base image used for Java application.
|`maintainer`    |String    |Value of `user.home` system property |The name and email address of the image maintainer.
|`port`          |Integer   |8080                                 |The Docker image entry point port used for the Java application.
|`tag`           |String    |<applicationName>:<projectVersion>   |The tag used for the Docker image.
|=======


=== Usage example

[source,groovy]
----
docker {
    javaApplication {
        baseImage = 'dockerfile/java:openjdk-7-jre'
        maintainer = '<NAME> "<EMAIL>"'
        port = 9090
        tag = 'jettyapp:1.115'
    }
}
----


=== Default tasks

The plugin provides a set of tasks for your project and preconfigures them with sensible defaults.

[options="header"]
|=======
|Task name                 |Depends On                |Type                                                                                 |Description
|`dockerCopyDistResources` |`distTar`                 |link:http://www.gradle.org/docs/current/javadoc/org/gradle/api/tasks/Copy.html[Copy] |Copies the resource files (like the Java application's TAR file) to a temporary directory for image creation.
|`dockerDistTar`           |`dockerCopyDistResources` |Dockerfile                                                                           |Creates the Docker image for the Java application.
|`dockerBuildImage`        |`dockerDistTar`           |DockerBuildImage                                                                     |Builds the Docker image for the Java application.
|`dockerPushImage`         |`dockerBuildImage`        |DockerPushImage                                                                      |Pushes created Docker image to the repository.
|=======


=== Usage examples

The following usage examples demonstrate code for common use cases. More scenarios can be found in the link:https://github.com/bmuschko/gradle-docker-plugin/blob/master/src/integTest/groovy/com/bmuschko/gradle/docker/DockerJavaApplicationPluginIntegrationTest.groovy[integration tests].

[source,groovy]
----
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.bmuschko.docker-java-application'

version = '1.0'
sourceCompatibility = 1.7

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.eclipse.jetty.aggregate:jetty-all:9.2.5.v20141112'
}

mainClassName = 'com.bmuschko.gradle.docker.application.JettyMain'

docker {
    javaApplication {
        maintainer = '<NAME> "<EMAIL>"'
    }
}
----
<commit_msg>Fix used Docker Java version and supported Docker client API version.<commit_after>Gradle Docker plugin
====================

image:https://d3oypxn00j2a10.cloudfront.net/0.12.6/img/nav/docker-logo-loggedout.png[Docker Logo]

Gradle plugin for managing link:https://www.docker.io/[Docker] images and containers using via its
link:http://docs.docker.io/reference/api/docker_remote_api/[remote API]. The heavy lifting of communicating with the
Docker remote API is handled by the link:https://github.com/docker-java/docker-java[Docker Java library]. Currently,
version 0.10.5 is used which assumes Docker's client API v1.16.

link:https://snap-ci.com/bmuschko/gradle-docker-plugin/branch/master[image:https://snap-ci.com/bmuschko/gradle-docker-plugin/branch/master/build_image[Build Image]]

== Usage

To use the plugin, include in your build script:

[source,groovy]
----
buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.bmuschko:gradle-docker-plugin:0.8.2'
    }
}
----


== Provided plugins

The JAR file comes with two plugins:

[options="header"]
|=======
|Plugin Identifier                    |Applies                        |Type                                                                                                                                                        |Description
|com.bmuschko.docker-remote-api       |-                              |link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/DockerRemoteApiPlugin.html[DockerRemoteApiPlugin]             |Provides custom tasks for interacting with Docker via its remote API.
|com.bmuschko.docker-java-application |com.bmuschko.docker-remote-api |link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/DockerJavaApplicationPlugin.html[DockerJavaApplicationPlugin] |Creates and pushes a Docker image for a Java application.
|=======

== Remote API plugin

The plugin `com.bmuschko.docker-remote-api` allows for interacting with Docker via its remote API. You can model any workflow
imaginable by creating enhanced task of the custom task provided by the plugin. To use the plugin, include the following
code snippet in your build script:

[source,groovy]
----
apply plugin: 'com.bmuschko.docker-remote-api'
----


=== Custom task types

==== Misc

The plugin provides the following general-purpose custom task types:

[options="header"]
|=======
|Type                                                                                                                                  |Description
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/DockerInfo.html[DockerInfo]       |Displays system-wide information.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/DockerVersion.html[DockerVersion] |Show the docker version information.
|=======


==== Images

The plugin provides the following custom task types for managing images:

[options="header"]
|=======
|Type                                                                                                                                                  |Description
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/Dockerfile.html[Dockerfile]                 |Creates a Dockerfile based on the provided instructions.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerBuildImage.html[DockerBuildImage]     |Builds an image from a Dockerfile.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerCommitImage.html[DockerCommitImage]   |Creates a new image from a container's changes.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerInspectImage.html[DockerInspectImage] |Returns low-level information on the image.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerListImages.html[DockerListImages]     |Lists images in registry.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerPullImage.html[DockerPullImage]       |Pulls an image from the registry.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerPushImage.html[DockerPushImage]       |Pushes an image to a registry.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerRemoveImage.html[DockerRemoveImage]   |Removes an image from the filesystem.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/image/DockerTagImage.html[DockerTagImage]         |Tags an image in registry.
|=======


==== Containers

The plugin provides the following custom task types for managing containers:

[options="header"]
|=======
|Type                                                                                                                                                              |Description
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerCreateContainer.html[DockerCreateContainer]   |Creates a container.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerKillContainer.html[DockerKillContainer]       |Kills the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerRemoveContainer.html[DockerRemoveContainer]   |Removes the container for a given id from the filesystem.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerRestartContainer.html[DockerRestartContainer] |Restarts the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerStartContainer.html[DockerStartContainer]     |Starts the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerStopContainer.html[DockerStopContainer]       |Stops the container for a given id.
|link:http://bmuschko.github.io/gradle-docker-plugin/docs/groovydoc/com/bmuschko/gradle/docker/tasks/container/DockerWaitContainer.html[DockerWaitContainer]       |Blocks until container for a given id stops, then returns the exit code.
|=======


=== Extension properties

The plugin defines the following extension properties in the `docker` closure:

[options="header"]
|=======
|Property name   |Type      |Default value            |Description
|`url`           |String    |http://localhost:2375    |The server URL to connect to via Docker's remote API.
|`certPath`      |File      |null                     |The path to certificates for communicating with link:https://docs.docker.com/articles/https/[Docker over SSL].
|=======

For pushing an image to the Docker Hub registry or to a self-hosted one, you will also need to provide credentials in
the `registry` closure:

[options="header"]
|=======
|Property name   |Type      |Default value               |Description
|`url`           |String    |https://index.docker.io/v1  |The registry URL.
|`username`      |String    |null                        |The registry username.
|`password`      |String    |null                        |The registry password.
|`email`         |String    |null                        |The registry email address.
|=======


==== Extension examples

===== Working with a TLS-enabled Docker instance

Starting with Docker version 1.3, TLS is enabled by default. Please consult the Docker documentation link:https://docs.docker.com/articles/https/["Running Docker
with https"] to set up your certificate. The following example demonstrates how to configure the plugin to use those certifactes.
Additionally, this code snippet shows how to set the user credentials.

[source,groovy]
----
docker {
    url = 'https://192.168.59.103:2376'
    certPath = new File(System.properties['user.home'], '.boot2docker/certs/boot2docker-vm')

    registry {
        url = 'https://index.docker.io/v1'
        username = 'bmuschko'
        password = '<PASSWORD>'
        email = '<EMAIL>'
    }
}
----

===== Working with a Docker instance without TLS

The following example assumes that you disabled TLS on your Docker instance. You can do so by setting `DOCKER_TLS=no` in the file
 `/var/lib/boot2docker/profile`. Additionally, this code snippet shows how to set the user credentials.

[source,groovy]
----
docker {
    url = 'http://192.168.59.103:2375'
}
----

=== Usage examples

The following usage examples demonstrate code for common use cases. More scenarios can be found in the link:https://github.com/bmuschko/gradle-docker-plugin/blob/master/src/integTest/groovy/com/bmuschko/gradle/docker/DockerWorkflowIntegrationTest.groovy[integration tests].

==== Creating a Dockerfile and building an image

A Dockerfile can be created by the `Dockerfile` custom tasks. The Dockerfile instructions need to be declare in the correct
order.

[source,groovy]
----
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage

task createDockerfile(type: Dockerfile) {
    destFile = project.file('build/mydockerfile/Dockerfile')
    from 'ubuntu:12.04'
    maintainer '<NAME> "<EMAIL>"'
}

task buildImage(type: DockerBuildImage) {
    dependsOn createDockerfile
    inputDir = createDockerfile.destFile.parentFile
    tag = 'bmuschko/myimage'
}
----

==== Executing functional tests against a running container

The following example code demonstrates how to build a Docker image from a Dockerfile, starts up a container for this
image and exercises functional tests agains the running container. At the end of this operation, the container is stopped.

[source,groovy]
----
import com.bmuschko.gradle.docker.tasks.container.*
import com.bmuschko.gradle.docker.tasks.image.*

task buildMyAppImage(type: DockerBuildImage) {
    inputDir = file('docker/myapp')
    tag = 'test/myapp'
}

task createMyAppContainer(type: DockerCreateContainer) {
    dependsOn buildMyAppImage
    targetImageId { buildMyAppImage.getImageId() }
}

task startMyAppContainer(type: DockerStartContainer) {
    dependsOn createMyAppContainer
    targetContainerId { createMyAppContainer.getContainerId() }
}

task stopMyAppContainer(type: DockerStopContainer) {
    targetContainerId { createMyAppContainer.getContainerId() }
}

task functionalTestMyApp(type: Test) {
    dependsOn startMyAppContainer
    finalizedBy stopMyAppContainer
}
----


== Java application plugin

The plugin `com.bmuschko.docker-java-application` is a highly opinonated plugin for projects applying the link:http://www.gradle.org/docs/current/userguide/application_plugin.html[application plugin].
Under the covers the plugin preconfigures tasks for creating and pushing Docker images for your Java application. The default
configuration is tweakable via an exposed extension. To use the plugin, include the following code snippet in your build script:

[source,groovy]
----
apply plugin: 'com.bmuschko.docker-java-application'
----


=== Extension properties

The plugin defines the following extension properties in the `javaApplication` closure:

[options="header"]
|=======
|Property name   |Type      |Default value                        |Description
|`baseImage`     |String    |java                                 |The Docker base image used for Java application.
|`maintainer`    |String    |Value of `user.home` system property |The name and email address of the image maintainer.
|`port`          |Integer   |8080                                 |The Docker image entry point port used for the Java application.
|`tag`           |String    |<applicationName>:<projectVersion>   |The tag used for the Docker image.
|=======


=== Usage example

[source,groovy]
----
docker {
    javaApplication {
        baseImage = 'dockerfile/java:openjdk-7-jre'
        maintainer = '<NAME> "<EMAIL>"'
        port = 9090
        tag = 'jettyapp:1.115'
    }
}
----


=== Default tasks

The plugin provides a set of tasks for your project and preconfigures them with sensible defaults.

[options="header"]
|=======
|Task name                 |Depends On                |Type                                                                                 |Description
|`dockerCopyDistResources` |`distTar`                 |link:http://www.gradle.org/docs/current/javadoc/org/gradle/api/tasks/Copy.html[Copy] |Copies the resource files (like the Java application's TAR file) to a temporary directory for image creation.
|`dockerDistTar`           |`dockerCopyDistResources` |Dockerfile                                                                           |Creates the Docker image for the Java application.
|`dockerBuildImage`        |`dockerDistTar`           |DockerBuildImage                                                                     |Builds the Docker image for the Java application.
|`dockerPushImage`         |`dockerBuildImage`        |DockerPushImage                                                                      |Pushes created Docker image to the repository.
|=======


=== Usage examples

The following usage examples demonstrate code for common use cases. More scenarios can be found in the link:https://github.com/bmuschko/gradle-docker-plugin/blob/master/src/integTest/groovy/com/bmuschko/gradle/docker/DockerJavaApplicationPluginIntegrationTest.groovy[integration tests].

[source,groovy]
----
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.bmuschko.docker-java-application'

version = '1.0'
sourceCompatibility = 1.7

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.eclipse.jetty.aggregate:jetty-all:9.2.5.v20141112'
}

mainClassName = 'com.bmuschko.gradle.docker.application.JettyMain'

docker {
    javaApplication {
        maintainer = '<NAME> "<EMAIL>"'
    }
}
----

{'fraction_non_alphanumeric': 0.10868498527968597, 'fraction_numerical': 0.006518996214776391, 'mean_word_length': 2.9828308207705194, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 24, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 82, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5062237', 'n_tokens_mistral': 8367, 'n_tokens_neox': 7798, 'n_words': 1978}