True. However, I tend to see buildDocker as a "assembly" step. build then ties together assembly and tests tasks.
In which case we will need a custom task here whatever you do in the plugin
That's mostly a question of taste though. So dependsOn: build is definately ok, especially in a tutorial (short & conscise to read!)
But yeah in general, we should make your use-case more straight-forward with the plugin.
because the plugin will never know that its default task should depend on something from another plugin that it doesn't require already
the plugin only creates a default task if the application plugin is used as well.
otherwise it doesn't create a task on its own
I see. Well, somewhat accidentally, and for historical reasons, the "spring-boot" plugin also adds the "application" plugin
So that's always there in this use case
we recently started using spring-boot at work here so we'll be adding some more convenience into the plugin one way or the other. can't tell you when though... :-)
in that case the route via the automatic distDocker is definately the most straight-forward and convenient. but then you won't reuse the Dockerfile from the maven example...
Greg L. Turnquist
Good morning. Glad to see this being polished up by people more gradle savy than me. I'll test the mods on my Mac when I get home.
hint: if you add
to your Dockerfile you can start containers with the -P/--publish-all flag.
I know. But I don't know enough to know why it matters yet. It gets published to a random port.
I think for this tutorial it's not necessary anyway
for one it tells the user that the contained app uses port 8080 and for the other the Docker engine has some reflection possibilties where you can basically ask the engine how container ports are mapped during runtime.
e.g. useful for container linking
In general it is considered a good practice to use EXPOSE whenever possible.
OK. Thanks. I use it in other containers.
This one is just so basic it didn't necessarily warrant it. But I think you are right: it's at least a courtesy to the user (assuming he has access to the Dockerfile - which I would think would be more customary than it seems to be in the Docker community).
Hi guys, I would like to about usage of your plugin on Mac. I've found that it is necessary to setup ip form my boot2docker VM as an API URL. You use docker-java library and I went through their code and it seems that it can use env variables (DOCKER_HOST, DOCKER_CERT and DOCKER_TSL_VERIFY) if you don't specify otherwise. Can I use this in current 1.2 version and I just missed that or do you plan it to another release? I would like to avoid putting ip to gradle files.
Greg L. Turnquist
Regarding the export variables, I include specific steps to ensure that is setup on your mac to support the docker command. Is that addressing your question?
A thread on SO directed me to put this into .bash_profile => $(boot2docker shellinit 2> /dev/null)
That way, the exports are configured every time you open a new shell.
I wasn't sure if your and docker-java integration supports env variable usage. But it does. I execute gradle distDocker from IntelliJ and it doesn't have variable properly setup. Thanks for pointing me in correct direction.
Greg L. Turnquist
I can verify the update to our guide also works on my mac. Albeit, it is configured to push to a group I have no access to, and which no reader will have access to. So I'm leary about having a failing step in our guide.
We can take that discussion elsewhere
its nothing to do with the gradle tooling
Bruno René Santos
Hello all. Is there any way to include the param insecure-registry when pushing to a private registry?
insecure-registry has to be set as a startup parameter to the docker daemon, so there's not much the plugin can do about that at the moment. I think there are still some open issues about being able to do it ad-hoc on push and pull commands too
Hi all. Is it in plan to have a functionality which can run/stop the image created by the plugin?
Hi all. Will the docker-java-client be updated soon? I need a newer version as my docker host wont accept versions below 1.12.
Hello, guys. I didn't find in docs if the plugin is able to connect docker over tls (port 2376) rather than plain http (port 2375). Is it possible?
Hey guys. Any of you have an example of using the addFile task within distDocker? I'm attempting to package override application properties into my generated tar file.
Stefán Freyr Stefánsson
Hi there. I'm working on creating some docker containers in our build scripts using Transmode's gradle-docker plugin. I'm wondering what the correct way is for my scenario which is that in each "build cycle" we create multiple containers, one "tools" container and then multiple containers that extend the tools container and only differ by which ports they expose and what entrypoint is used. So I would like to create the tools container in one task and then create all the other derived containers in other tasks but I'm not sure how I can do this without having the "tools container task" publish our tools container to a docker hub and have the other tasks pull that container. I hope I'm making myself at least vaguely clear here... does anybody have a solution to this?
Hi all! Is it possible to run build script using /bin/sh?
Hi..How to push image to a private repository. The Repository needs to be specified as registry="example.com". How to mention the username and password ?
Hi all. Is gradle-docker plugin will be able to work with Docker Remote API when the version of the docker is 1.12+ ?
Is there any chance that this plugin will be published in gradle plugins repo ?
Is there a channel to ask Gradle questions?
Hi, when I've got my dockerfile build and want to publish, how is this done? I can't seem to figure out how the "docker tag image username/repository:tag" and "docker push username/repository:tag" is done in this plugin
I think you get a tag by default (based on the groupId and jar name). It's easy to check.
Then you can just docker push (you don't need gradle for that)
yes I've applied the group, applicationName and tagVersion. But how do i access my tag variable, $tag ?