Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue when including image "cannot copy to non-directory" #1

Open
kretes opened this issue Jul 14, 2020 · 3 comments
Open

issue when including image "cannot copy to non-directory" #1

kretes opened this issue Jul 14, 2020 · 3 comments

Comments

@kretes
Copy link

kretes commented Jul 14, 2020

Hello.

First of all thanks for the tool - this is a good idea to have one like this.

I encountered an issue with the following Dockerfile:

#syntax=bergkvist/includeimage

FROM jupyter/datascience-notebook

INCLUDE openjdk:11.0.7-jre-buster

I get:

> DOCKER_BUILDKIT=1 docker build -t included1 .

failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: cannot copy to non-directory: /var/lib/docker/overlay2/wll16e5y1622ez736xegsf987/merged/bin

The same happens when I reverse the images

however when I explicitly build an image with:

FROM jupyter/datascience-notebook

COPY --from=openjdk:11.0.7-jre-buster / /

It works.

Do you have any idea what is going on? Thanks

@bergkvist
Copy link
Owner

bergkvist commented Jul 14, 2020

Oh, this is weird! I think you have discovered a problem in Docker Buildkit itself.

Consider the Dockerfile below (without any include syntax):

FROM jupyter/datascience-notebook
COPY --from=openjdk:11.0.7-jre-buster / /

This fails

DOCKER_BUILDKIT=1 docker build -t pyjdk .
Logs:
[+] Building 4.5s (6/6) FINISHED                                                                                                                                            
 => [internal] load build definition from Dockerfile                                                                                                                   0.5s
 => => transferring dockerfile: 119B                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                      0.3s
 => => transferring context: 2B                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/jupyter/datascience-notebook:latest                                                                                         1.2s
 => CACHED FROM docker.io/library/openjdk:11.0.7-jre-buster                                                                                                            0.0s
 => => resolve docker.io/library/openjdk:11.0.7-jre-buster                                                                                                             0.5s
 => CACHED [stage-0 1/2] FROM docker.io/jupyter/datascience-notebook@sha256:3dd117acdfe72203d3068a1c40b6a8c3c79e0db473bfecb12d955bc832c01734                           0.0s
 => ERROR [stage-0 2/2] COPY --from=openjdk:11.0.7-jre-buster / /                                                                                                      2.2s
------
 > [stage-0 2/2] COPY --from=openjdk:11.0.7-jre-buster / /:
------
failed to solve with frontend dockerfile.v0: failed to build LLB: cannot copy to non-directory: /var/lib/docker/overlay2/yy5ha7qkd2afgi6a80kv036qr/merged/bin

But this works

docker build -t pyjdk .
Logs:
Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM jupyter/datascience-notebook
latest: Pulling from jupyter/datascience-notebook
a4a2a29f9ba4: Already exists 
127c9761dcba: Already exists 
d13bf203e905: Already exists 
4039240d2e0b: Already exists 
16baf7565818: Already exists 
8d4b4e3fa8e0: Already exists 
9b5cd6dc7e5c: Already exists 
2fadbbcf7ce9: Already exists 
0cd922ae20a5: Already exists 
f5e764406ee1: Already exists 
011a76fea054: Already exists 
1b59e5a8c825: Already exists 
3f4f1174f174: Already exists 
430109c788cf: Already exists 
ef6b34bbbee3: Already exists 
edc996f5b41a: Already exists 
5c69830ff598: Already exists 
17932824baa9: Already exists 
25c98e42fcbd: Already exists 
b6f59bca789a: Already exists 
9bce9285d933: Already exists 
5cf1664cf6c7: Already exists 
b9e19085c433: Already exists 
e14982a374a7: Already exists 
eb44380d0793: Already exists 
72f8a1979c6a: Already exists 
ae57cbe35ef2: Already exists 
Digest: sha256:3dd117acdfe72203d3068a1c40b6a8c3c79e0db473bfecb12d955bc832c01734
Status: Downloaded newer image for jupyter/datascience-notebook:latest
 ---> e86d6091d90f
Step 2/2 : COPY --from=openjdk:11.0.7-jre-buster / /
11.0.7-jre-buster: Pulling from library/openjdk
e9afc4f90ab0: Already exists 
989e6b19a265: Already exists 
af14b6c2f878: Already exists 
68a79816c3e1: Already exists 
e440f69a0a76: Already exists 
837b533a935d: Already exists 
Digest: sha256:562e3027af6520a83990f1831b7e2b6a44e156b18846109f4027cc7caeb8d4a9
Status: Downloaded newer image for openjdk:11.0.7-jre-buster
 ---> 0399e5b96bff
Successfully built 0399e5b96bff
Successfully tagged pyjdk:latest

Assuming you are using the latest version of jupyter/datascience-notebook - it inherits from ubuntu:focal. On the other hand, openjdk inherits from debian:buster.

Since the base images systems don't match - things might go wrong when copying one filesystem on top of another.

@kretes
Copy link
Author

kretes commented Jul 15, 2020

Hi,

I can agree that using different base image can make it a nice mess.

However - you found out that this copying only fails what run with DOCKER_BUILDKIT=1 which (as far as I understand) is a new build system for docker.

Anyway - for my particular case I will anyway try to find at least images with the same base distro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants