Reputation: 71
I'm facing intermittent build job failures with the below error.
[0munknown parent image ID sha256:478c35b0xxxxxxxxxxxxxxx
Build step 'Execute shell' marked build as failure
Upvotes: 7
Views: 11435
Reputation: 6831
To prevent this from happening, perform all docker "cleanup" operations (with docker system prune
and docker rmi
) in such a way that no build pipeline (with docker build
) can be running at the same time as the cleanup process.
Assuming that your cleanup operations are also automated with Jenkins, you can try to make the cleanup and build pipelines non-overlapping.
One (imperfect) solution is the Priority Sorter Plugin, using which you can:
runExclusive: true
.It's imperfect as it does not affect running pipelines retroactively.
This problem is caused by a Docker build cache misses that were not predictable in advance (when the failing build started), because the relevant layers disappeared from the build cache at a later stage of the (long-running) build, removed by some other heavy-handed "cleanup" process.
To verify that this is the reason, check that the digest displayed by Jenkins docker plugin in its error message is indeed missing from the local images cache:
# given this Jenkins docker plugin error message:
unknown parent image ID sha256:a7b0fc09ca549c852550f050ef2079663232405f0e3abd5c1a0051f30eb448f4
# ... let's search for the missing digest:
$ docker images --digests | grep a7b0fc09ca549c852550f050ef2079663232405f0e3abd5c1a0051f30eb448f4
$
Upvotes: 0
Reputation: 7163
This can be a flake on various machines with shared disk between docker
processes, e.g. Buildkite instances. Simply restarting the build worked for me.
Upvotes: 0
Reputation: 121
Use the --no-cache tag in the build command line.
docker build --no-cache -t dockerimagenew:v1 .
Upvotes: 0
Reputation: 51
This generally occurs when you simultaneously clean up the docker memory (or someone delete the content of /var/lib/docker/image/overlay2/imagedb/content or run docker system prune at the same time) , so the image you are building unable to locate the parent folder in which image data is present. Make sure this wont be happening at same time and restarts the build.
Upvotes: 5
Reputation: 29068
I had this same concern when building a docker image. The error message I got is below:
[Docker] ERROR: Failed to create docker image: Could not build image: unknown parent image ID sha256:cc0b3bd844b13a2ebfc6915019a8194538f2d0b41e420b76a20702e985e2a298
ERROR: Build step failed with exception
com.github.dockerjava.api.exception.DockerClientException: Could not build image: unknown parent image ID sha256:cc0b3bd844b13a2ebfc6915019a8194538f2d0b41e420b76a20702e985e2a298
What worked for me was just trying to rebuild the image again, and it worked fine.
That's all.
I hope this helps
Upvotes: 0
Reputation: 145
If you have an image with none
name, then you need to remove this and rebuild your container. That's what solved it for me.
Upvotes: 2