Docker build is failing with "failed to export image: failed to set parent sha256" error

Hi,

I am using the docker community version 20.10.6 in my environment. I also have a docker swarm in that I have deployed my Jenkins docker service. I have customized the Jenkins image to use the local docker within the Jenkins docker container. So whenever I run the pipeline my pipeline will build the application docker images. So now for the past 2-3 days, I am observed that from multiple servers I am seeing some random docker build failures and showing errors like unknown parent image ID sha256:<Intermediate container SHA Value> or failed to export image: failed to set parent sha256:<Intermediate SHA value>: unknown parent image ID:<Intermediate SHA value>

So not really sure what’s happening and we did not change any docker version recently. So can anyone please help me dig deep more about this.?

Based on my observation I see it’s happening only at multiple copy commands in docker files.

My docker version:
Client: Docker Engine - Community
Version: 20.10.6
API version: 1.41
Go version: go1.13.15
Git commit: 370c289
Built: Fri Apr 9 22:46:01 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.6
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8728dd2
Built: Fri Apr 9 22:44:13 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Can you reproduce it with a Dockerfile that you can share? If it happened on one machine I would say your filesystem is damaged, but since it is happening on multiple servers, it is not likely that all servershave damaged filesystem.