We used the api to build a model that installs pip dependencies for a python application.
Running the pip install outputs "Sucessfully built <package" for packages that are built.
This caused the api to return the name due to the implementation of parsing the imageId in the BuildImageResultCallback class.
We fixed it by adding a lastStepDone boolean that waits for Step n/n done and then enables the imageId parsing by waiting for "Sucessfully built <...>"
Should I open a pr with our solution I think there is no disadvantage to wait for docker image build completion before parsing the image id?
Just ran into this via https://github.com/bmuschko/gradle-docker-plugin, also using pip. My proposed solution was going to be to tweak onNext to null out this.imageId when an error is received. It could make sense to not parse until the stream was finished, but since BuildImageResultCallback.getImageId is private and can't be called until the POST /build is completed, it might be just as simple to check for a error before checking for the imageId.
Activity
niloc132 commented on Feb 2, 2024
Just ran into this via https://github.com/bmuschko/gradle-docker-plugin, also using pip. My proposed solution was going to be to tweak onNext to null out this.imageId when an error is received. It could make sense to not parse until the stream was finished, but since BuildImageResultCallback.getImageId is private and can't be called until the POST /build is completed, it might be just as simple to check for a error before checking for the imageId.
docker-java/docker-java-api/src/main/java/com/github/dockerjava/api/command/BuildImageResultCallback.java
Lines 69 to 79 in 1bac81f
could instead be
If BuildImage fails but logs something about success, don't succeed
If BuildImage fails but logs something about success, don't succeed (#…