Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DockerBuildImage fails with Docker 17.05 #830

Closed
dmitrygusev opened this issue Apr 17, 2017 · 15 comments
Closed

DockerBuildImage fails with Docker 17.05 #830

dmitrygusev opened this issue Apr 17, 2017 · 15 comments
Milestone

Comments

@dmitrygusev
Copy link
Contributor

Version 17.05.0-ce-rc1-mac8 (16582)
Channel: edge
73d01bb48e

Fails with NPE (see below) although docker build itself succeeded:

Step 12/12 : CMD bundle exec rake db:migrate && bundle exec rails s
---> Using cache
---> b7c2febdf592
Successfully built b7c2febdf592
Successfully tagged app:b2279a4

As I understand the reason is that last line in the build output is now not "Successfully built", but "Successfully tagged".

Stacktrace:

Caused by: com.github.dockerjava.api.exception.DockerClientException: Could not build image: null
        at com.github.dockerjava.core.command.BuildImageResultCallback.getImageId(BuildImageResultCallback.java:71)
        at com.github.dockerjava.core.command.BuildImageResultCallback.awaitImageId(BuildImageResultCallback.java:48)
        at java_lang_reflect_Method$invoke.call(Unknown Source)
        at java_lang_reflect_Method$invoke.call(Unknown Source)
        at com.bmuschko.gradle.docker.utils.DockerThreadContextClassLoader$_createPrintStreamProxyCallback_closure12.doCall(DockerThreadContextClassLoader.groovy:577)
        at com.sun.proxy.$Proxy160.invoke(Unknown Source)
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$994b76df.awaitImageId(<generated>)
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$994b76df$awaitImageId.call(Unknown Source)
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$48a3fefd$awaitImageId.call(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.image.DockerBuildImage.runRemoteCommand(DockerBuildImage.groovy:127)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask$_runReactiveStream_closure1.doCall(AbstractDockerRemoteApiTask.groovy:57)
        at com.bmuschko.gradle.docker.utils.DockerThreadContextClassLoader.withClasspath(DockerThreadContextClassLoader.groovy:54)
        at com.bmuschko.gradle.docker.utils.ThreadContextClassLoader$withClasspath.call(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask.runInDockerClassPath(AbstractDockerRemoteApiTask.groovy:62)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask$runInDockerClassPath.callCurrent(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask.runReactiveStream(AbstractDockerRemoteApiTask.groovy:56)
        at com.bmuschko.gradle.docker.tasks.AbstractReactiveStreamsTask.start(AbstractReactiveStreamsTask.groovy:50)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:632)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:615)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
        ... 70 more
@KostyaSha
Copy link
Member

Could you check how this logic is handled in docker CLI sources? We usually implement the same.

@dmitrygusev
Copy link
Contributor Author

Here's the change in builder:
Added 'Successfully tagged'

@KostyaSha
Copy link
Member

KostyaSha commented Apr 18, 2017 via email

@dmitrygusev
Copy link
Contributor Author

If I understand this right, the simplest way is probably to keep two latest lines of the output in the BuildImageResultCallback.java:31.

And when time comes pick one of the two that matches the "Successfully built" pattern.

What do you think?

@KostyaSha
Copy link
Member

I think that it will fail on non-17 versions that we can't accept. And it seems that you found only daemon side, while we should check CLI code and how they handle it.

@dmitrygusev
Copy link
Contributor Author

Why would it fail if it's an additive change? Previous versions will still be able to find the "Successfully built" string in the last BuildResponseItem. New versions will find it in a line before the last.

I'm not sure I understand what you mean by saying "how Docker CLI handles this"?
I don't think Docker CLI interprets the output anyhow, it just prints it to the stdout.
And the way docker-java handles it -- it just reads everything from that output stream and takes the last line. Or am I wrong here?

dmitrygusev added a commit to dmitrygusev/docker-java that referenced this issue Apr 18, 2017
dmitrygusev added a commit to dmitrygusev/docker-java that referenced this issue Apr 18, 2017
@dmitrygusev
Copy link
Contributor Author

@KostyaSha anything else I can do to get the proposed fix merged?

KostyaSha pushed a commit that referenced this issue Apr 23, 2017
* Proposed fix for #830

* Simplify the fix for #830
@KostyaSha KostyaSha added this to the 3.0.10 milestone Apr 23, 2017
vuminhkh added a commit to alien4cloud/docker-java that referenced this issue Apr 30, 2017
* master-docker-java: (25 commits)
  Add some coding styles.
  Allow an explicit Dockerfile location string to be specified to the build command (docker-java#825)
  Proposed fix for docker-java#830 (docker-java#832)
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release 3.0.9
  Fix test.
  Update CHANGELOG.md
  Responce may contains token.
  adding support for unless-stopped restart policy
  Generate OSGi compliant manifest (docker-java#797)
  exclude commons-logging since docker-java uses slf4j/logback
  Unable to deserialize status response from amazon ECR login
  Ensure FakeDockerServer is started on a random free port
  Fixes docker-java#807. NettyDockerCmdExecFactory ignores API version configuration
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release 3.0.8
  Update CHANGELOG.md
  Added healthcheck support in container inspect JSON result
  Use TLSv2 by default
  rerun failing tests count to 3
  ...

# Conflicts:
#	pom.xml
@cdancy
Copy link
Contributor

cdancy commented May 11, 2017

@KostyaSha any chance we could get a release with this change in place? Running into more than a few hiccups because of this...

@KostyaSha
Copy link
Member

Yes, stuck with swarm tests. Also almost ready to do swarm releases... But tests...

@KostyaSha
Copy link
Member

Btw, does this all work fine with multi-sage builds?

@cdancy
Copy link
Contributor

cdancy commented May 12, 2017

No issues that I've found thus far. What are your concerns and/or what are you thinking?

@KostyaSha
Copy link
Member

End of build marker is xXX built/tagged multi-stage do multiple builds...

@docwhat
Copy link

docwhat commented May 12, 2017

Updated link to the change in docker (now moby)

@docwhat
Copy link

docwhat commented May 12, 2017

Also, is this a problem in the dockerd service or the docker client? Can this be worked around by using an older docker client (but leaving the dockerd at the latest version)?

@cdancy
Copy link
Contributor

cdancy commented May 12, 2017

@KostyaSha FYI: running our gradle-docker-plugin integration tests against your 3.0.10-SNAPSHOT version does indeed solve our tests breaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants