gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

Support running Docker containers

Open sfitts opened this issue 10 years ago • 8 comments

There are times when using Docker as part of a build environment involves running images after they are built (for example to build an artifact that has a specialized environment). In this case it would be handy to be able to run containers as part of the build process.

sfitts avatar Jul 28 '14 16:07 sfitts

FYI -- I'm currently working on this since it is something we need in our build environment.

sfitts avatar Jul 28 '14 16:07 sfitts

Creating containers from images, then running, pausing and stopping them would be a nice feature. I think it would be best to implement this as seperate tasks (DockerRun, DockerStop, ...) so that the existing Docker task type not gets too crowded. What do you think?

mattgruter avatar Jul 28 '14 21:07 mattgruter

It might be worthwhile to check out @bmuschko (https://github.com/bmuschko/gradle-docker-plugin) docker plugin. Maybe something we can build on.

mattgruter avatar Jul 28 '14 21:07 mattgruter

Agreed. I've got a DockerRun task type essentially implemented at this point. Doesn't support every run option (there are lots and I'm not sure they are all valuable in this context), but I have support for: --name, -d, --rm, --link, --volume, --publish, and --volumes-from.

Hadn't thought of adding a DockerStop, but that makes sense as well.

sfitts avatar Jul 28 '14 21:07 sfitts

Interesting, I'll take a look and see what we might be able to use.

Oh, I also have support for --env as well. One downside right now is that I need docker-java 0.9.1-SNAPTSHOT since it has a bunch of the run options that I use. I'm going to poke the dev list and see if/when they can get that released. Hopefully ownership hasn't lapsed again.

sfitts avatar Jul 28 '14 22:07 sfitts

FYI -- the docker-java guy is back from vacation and expects to have the 0.9.1 release out this week.

sfitts avatar Jul 29 '14 20:07 sfitts

Great news! Thanks for the information..

mattgruter avatar Jul 29 '14 21:07 mattgruter

Is there any chance of getting a new release soon that includes this feature?

davidyscott avatar Feb 01 '17 01:02 davidyscott