aws / aws-nitro-enclaves-with-k8s

Tools and guides for using AWS Nitro Enclaves with Amazon EKS.
Apache License 2.0
32 stars 11 forks source link

ERROR: failed to solve: cannot copy to non-directory #35

Open berry2012 opened 3 months ago

berry2012 commented 3 months ago

Error when building the Hello Enclaves enclave image file and package it into a Docker image.

$ enclavectl build --image hello
 => => naming to docker.io/library/ne-build-hello-eif:1.0                                                                                                                                                     0.0s
Start building the Enclave Image...
Using the locally available Docker image...
Enclave Image successfully created.
{
  "Measurements": {
    "HashAlgorithm": "Sha384 { ... }",
    "PCR0": "354467acfce0f537718014efb6b089405df00abd20e554a32aca4d9e0af11a644d892f10830821dd870ad26bf6844b86",
    "PCR1": "0343b056cd8485ca7890ddd833476d78460aed2aa161548e4e26bedf321726696257d623e8805f3f605946b3d8b0c6aa",
    "PCR2": "0dc156f4b5cc7f90c8620d3fa60e0e9132a1144b4385dd7bcb9efb60ef0c8446b7f373446052c01cbeb2adbd982fb007"
  }
}
Error response from daemon: No such image: hello-351f9f32-be30-412c-aeea-2176b7e7acf1:latest
[+] Building 29.5s (10/12)                                                                                                                                                                          docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                          0.0s
 => => transferring dockerfile: 1.39kB                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/amazonlinux:2                                                                                                                                              0.3s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [internal] load build context                                                                                                                                                                             0.1s
 => => transferring context: 10.18MB                                                                                                                                                                          0.1s
 => CACHED [image 1/4] FROM docker.io/library/amazonlinux:2@sha256:d02b4bac5d085fa4e8f6e397e21315683ed11ae907b421177859e317b59e2f7c                                                                           0.0s
 => [full_image 2/5] RUN amazon-linux-extras install aws-nitro-enclaves-cli &&     yum install aws-nitro-enclaves-cli-devel jq -y                                                                            27.8s
 => [full_image 3/5] WORKDIR /ne-deps                                                                                                                                                                         0.0s
 => [full_image 4/5] RUN BINS="    /usr/bin/nitro-cli     /usr/bin/nitro-enclaves-allocator     /usr/bin/jq     " &&     for bin in $BINS; do         { echo "$bin"; ldd "$bin" | grep -Eo "/.*lib.*/[^ ]+";  0.5s
 => [full_image 5/5] RUN     mkdir -p /ne-deps/etc/nitro_enclaves &&     mkdir -p /ne-deps/run/nitro_enclaves &&     mkdir -p /ne-deps/var/log/nitro_enclaves &&     cp -rf /usr/share/nitro_enclaves/ /ne-d  0.5s
 => ERROR [image 2/4] COPY --from=full_image /ne-deps /                                                                                                                                                       0.1s
------
 > [image 2/4] COPY --from=full_image /ne-deps /:
------
Dockerfile:44
--------------------
  42 |     # to shrink the final image size.
  43 |     #
  44 | >>> COPY --from=full_image /ne-deps /
  45 |
  46 |     COPY bin/hello.eif /home
--------------------
ERROR: failed to solve: cannot copy to non-directory: /var/lib/docker/overlay2/cl7cj1jt99anjt496inersyc4/merged/lib64
[enclavectl] Error while building docker image! (Code: 1)
[enclavectl] Cannot build docker image for hello!
berry2012 commented 3 months ago

Attempted the same steps from another EC2 instance and didn't encounter the issue

berry2012 commented 2 months ago

temporary workaround was to go ahead with shrinking the image. Not the best though.

COPY --from=full_image / /