Gradle Docker plugin How to create docker image for task?

(Sharad Goyal) #1

I have gradle task. Let us assume the following
gradle tasks returns

  • runTask1 … some parameters(extracted from offline jars)
  • runTask2 … some parameters(extracted from offline jars)
  • runTask3 … some parameters(extracted from offline jars)
  • runTask100 … some parameters(extracted from offline jars)

After that, I can run all the task without having any problems because it finds all the parameters. Now I have created a docker image but it is not able to run because parameters are at gradle task level.

How I can build a docker image for each task? Is there a way?

(Benjamin Muschko) #2

What Docker plugin are you using?

(Sharad Goyal) #3

here is the docker information

docker info
Containers: 4
Running: 0
Paused: 0
Stopped: 4
Images: 4
Server Version: 17.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Volume: local
Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
Profile: default
Kernel Version: 4.9.27-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934 GiB
Name: moby
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 13
Goroutines: 21
System Time: 2017-05-16T13:58:03.3275631Z
EventsListeners: 0
Experimental: true
Insecure Registries:
Live Restore Enabled: false

(Benjamin Muschko) #4

I am not sure my question came across properly. As was asking which Gradle Docker plugin you are using in your build. I am not asking about Docker itself. Please check plugins or buildscript. Once identified I think it would make more sense to raise the question for the plugin project itself.

(Sharad Goyal) #5

Is this what you are looking?

apply plugin: ‘docker’

if (project.hasProperty(‘env’)) {
println "Target environment: $env"
sourceSets.main.resources.srcDir “src/main/resources/environment/$env”


docker {
baseImage = 'sercankaraoglu/vertx-base’
maintainer = ‘Sharad Goyal "’

(Benjamin Muschko) #6

Kind of. It still doesn’t tell us the coordinates of the plugin you are using. Or is a plugin that you wrote?