Hi Team - We are trying to build a docker image and this is a Multistage build.
docker build is erroring out with the below message
failed to compute cache key: failed to walk /opt/data/docker/data/tmp/buildkit-mount2977242485/usr/lib/.build-id/01/e11c545160c74b88b9ce9259e7467863eab9e7: lstat /opt/data/docker/data/tmp/buildkit-mount2977242485/usr/lib/.build-id/01/e11c545160c74b88b9ce9259e7467863eab9e7: no such file or directory
I can’t find it in the documentation, but the example in the docs is using absolute path and I have never tried to copy from another stage without absolute path as a source. Never even thought of doing it so I agree with @meyay, that is a very likely cause of the error message.
I forgot to mention why The motivation is to get debug information, so you can see the current location as absolute path and in which subfolder the folders you try to copy are.
Of course, once you identified how the absolute paths need to look like, you can remove the RUN instruction again.
I removed the second stage in my Dockerfile and built the image…I see the folders that I am trying to copy in the second stage are available on the container filesystem under /
drwxr-xr-x. 2 root root 6 Jan 26 11:33 snapshot-dependencies
drwxr-xr-x. 3 root root 16 Jan 26 11:33 spring-boot-loader
drwxr-xr-x. 4 root root 36 Jan 26 11:33 application
drwxr-xr-x. 3 root root 21 Jan 26 11:33 dependencies
[root@5917b498bdfe /]# pwd
/
#9 [stage-1 3/5] COPY --from=builder snapshot-dependencies/ / #9 sha256:576ab9b6d9a000b79634f5e01b190f2dfe6ec9836fcc8c2be70dd69e34d1e571 #9 ERROR: failed to walk /opt/data/docker/data/tmp/buildkit-mount4132688350/usr/lib/.build-id/01/e11c545160c74b88b9ce9259e7467863eab9e7: lstat /opt/data/docker/data/tmp/buildkit-mount4132688350/usr/lib/.build-id/01/e11c545160c74b88b9ce9259e7467863eab9e7: no such file or directory
#8 [stage-1 2/5] COPY --from=builder dependencies/ / #8 sha256:efe19f075625e924493bbec32599cb5eecda4227631d78004b9352975f2aa728 #8 ERROR: failed to walk /opt/data/docker/data/tmp/buildkit-mount4136272112/usr/lib/.build-id/01/e11c545160c74b88b9ce9259e7467863eab9e7: lstat /opt/data/docker/data/tmp/buildkit-mount4136272112/usr/lib/.build-id/01/e11c545160c74b88b9ce9259e7467863eab9e7: no such file or directory