Transmode / gradle-docker

A Gradle plugin to build Docker images from the build script.
Apache License 2.0
647 stars 142 forks source link

docker build task is hanging #37

Open wgorder opened 9 years ago

wgorder commented 9 years ago

This is the last line of output I see

12:17:59.618 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Using the native docker binary.
> Building 95% > :server:dockerBuild

I can run the command manually with no issues. I am not sure what is going on.

petehayes commented 9 years ago

I have run into the same problem. It is because in the NativeDockerClient, when it executes the docker command it does a waitFor() on the process. If the docker build process generates a lot of output to standard out or standard err, then it will eventually fill a buffer of the executing process and the process will block indefinitely while trying to write to the stream. Whenever processes are executed, you have to consume the standard out and standard err or ensure that there is little to no output in there.

cdancy commented 9 years ago

So the solution is to NOT use this task but instead fall back to using exec? @petehayes maybe we should put together a PR to solve the issue? I'm not sure how active this project is anymore judging from lack of commits going in

petehayes commented 9 years ago

Yes, I was going to give that a shot at some point to fix this and issue a pull request.

magnus-larsson commented 9 years ago

Hi, what is the status of this issue?

From my understanding this issue is, in many cases, a blocker for using the plugin on Windows? (never seen the problem on OS X)

See for example a discussion on the subject in the following blog post: http://callistaenterprise.se/blogg/teknik/2015/06/08/building-microservices-part-4-dockerize-your-microservices/

Regards, Magnus.

petehayes commented 9 years ago

In our case, we decided to move to the other gradle docker plugin so I won't be contributing a patch.

magnus-larsson commented 9 years ago

Ok, thanks for the update. I just realised that it already exists a pull request that seems to solve the issue so I'll post a comment there as well.