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

nerdctl fails to build for dockerfiles with full path #206

Closed
seemethere opened this issue May 13, 2021 · 9 comments
Closed

nerdctl fails to build for dockerfiles with full path #206

seemethere opened this issue May 13, 2021 · 9 comments

Comments

@seemethere
Copy link
Contributor

nerdctl installed with rootless containerd and buildkit fails to build dockerfiles when the dockerfile specified is a full path:

Simple Repro

Create test Dockerfile in your root directory (Dockerfile):

FROM alpine
RUN apk -U add curl

Run the following

$ nerdctl build -f $(realpath Dockerfile) .
[+] Building 0.1s (2/2) FINISHED                                                                                                                          
 => [internal] load build definition from /tmp/tmp.gdczD7DusJ/Dockerfile                                                                             0.1s
 => => transferring dockerfile: 2B                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                    0.1s
 => => transferring context: 2B                                                                                                                      0.0s
error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /tmp/buildkit-mount044783237/tmp/tmp.gdczD7DusJ/Dockerfile: no such file or directory
FATA[0000] unrecognized image format   
@fahedouch
Copy link
Member

Actually we don't support this

"--local=dockerfile=" + buildContext,

The dockerfile context is the same as the build context.
I will fix this.

Have a Nice day

@andel7
Copy link

andel7 commented Jan 13, 2022

Was this fixed ? I can't build image from Dockerfiles with the same error

@pmmlo
Copy link

pmmlo commented May 9, 2022

@andel7 Probably already moved on, but for future searchers.

This sounds stupid, but try running the build command at least 3 times after failure (if you know the Dockerfile works with Docker/docker CLI). For me, it progresses a little further each time until it succeeds in building a new image from Dockerfile.

@AkihiroSuda
Copy link
Member

Already fixed in nerdctl v0.8.2:

I also tested v0.19.0 locally and I don't see any regression.

@AkihiroSuda
Copy link
Member

@andel7 Are you seeing this error with Lima/Colima/Rancher Desktop?
If so, please make sure that your Dockerfile is located under /Users or any directory that is exposed to Lima.

@Cerebus
Copy link

Cerebus commented Jun 14, 2022

@andel7 Are you seeing this error with Lima/Colima/Rancher Desktop? If so, please make sure that your Dockerfile is located under /Users or any directory that is exposed to Lima.

Yes, and yes it is, but still getting this error.

nerdctl version 0.20.0

@Cerebus
Copy link

Cerebus commented Jun 14, 2022

Oh, nevermind. The problem was between the keyboard and the chair.

@ArVar
Copy link

ArVar commented Jun 22, 2022

I have a very similar issue:

 => [internal] load build definition from Dockerfile                                                              0.0s 
 => => transferring dockerfile: 2B                                                                                0.0s 
 => [internal] load .dockerignore                                                                                 0.0s 
 => => transferring context: 2B                                                                                   0.0s 
error: failed to solve: failed to read dockerfile: open /tmp/buildkit-mount3778739720/Dockerfile: no such file or direc
tory
FATA[0000] unrecognized image format

I'm pretty sure, there is something going wrong in passing the data from the context to the builder, i.e. the Dockerfile.
Using Rancher Desktop on windows 10 with WSL2 Ubuntu.
Edit: Rancher Desktop 1.4.1, nerdctl 0.20.0

@RPM8887
Copy link

RPM8887 commented Jul 6, 2022

I have a very similar issue:

 => [internal] load build definition from Dockerfile                                                              0.0s 
 => => transferring dockerfile: 2B                                                                                0.0s 
 => [internal] load .dockerignore                                                                                 0.0s 
 => => transferring context: 2B                                                                                   0.0s 
error: failed to solve: failed to read dockerfile: open /tmp/buildkit-mount3778739720/Dockerfile: no such file or direc
tory
FATA[0000] unrecognized image format

I'm pretty sure, there is something going wrong in passing the data from the context to the builder, i.e. the Dockerfile. Using Rancher Desktop on windows 10 with WSL2 Ubuntu. Edit: Rancher Desktop 1.4.1, nerdctl 0.20.0

The way I got this to work in Windows with your same config is by issuing the nerdctl command from an elevated command prompt/running as admin

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

8 participants