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

'docker build' error: "failed to solve with frontend dockerfile.v0" #415

Closed
2 tasks done
nromagno opened this issue Oct 15, 2020 · 78 comments · Fixed by #444
Closed
2 tasks done

'docker build' error: "failed to solve with frontend dockerfile.v0" #415

nromagno opened this issue Oct 15, 2020 · 78 comments · Fixed by #444

Comments

@nromagno
Copy link

nromagno commented Oct 15, 2020

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: DAA27533-4D93-4AF4-916C-8492CC6BF66B/20201015121621

Expected behavior

I expect to build a docker image from my Dockerfile for my R Shiny application.

Actual behavior

I get the resulting error from the docker build command:
Capture

Information

Docker version is:
Capture

Windows Version: Windows 10 Home, version 1909

And docker run hello-world does work as expected:
Capture

I'm working with Docker Desktop for Windows 10 Home and I've followed this guide for the installation:
Install Docker Desktop on Windows Home

Since I think I have followed the guide correctly, and passed the docker run hello-world test, I'm not sure how to begin debugging this error.

I would really appreciate any help on clarifying what the error means, and how to potentially address it. Thank you!

@nromagno nromagno changed the title Confusing error when building a Docker image 'docker build' error: "failed to solve with frontend dockerfile.v0" Oct 15, 2020
@stephen-turner
Copy link

Thanks for the report, moving to buildx repository.

@stephen-turner stephen-turner transferred this issue from docker/for-win Oct 15, 2020
@tonistiigi
Copy link
Member

Please post docker version and a reproducer. Also, check if there is anything interesting in the daemon logs.

@nromagno
Copy link
Author

nromagno commented Oct 19, 2020

@tonistiigi my docker version is:
Capture

Also, by reproducer, do you mean a reproducible example?

And for the daemon logs you suggested, I'm not sure if I have been able to locate them correctly. I followed the advice here on where to find them (on my Windows it was under AppData\Local\Docker and I found this log.txt file.

I looked through the log.txt file but I couldn't find anything helpful.

Is this the correct file? And did I miss something important within it?

@Muqito
Copy link

Muqito commented Oct 21, 2020

I noticed this as well with the same version after the update.

Fixed after I purged the settings and restarted.

@ArifIstaka
Copy link

ArifIstaka commented Oct 26, 2020

Name the file Dockerfile exactly. I got the same error because i named it DockerFile

@UlasKasim
Copy link

changing name 'Dockerfile' from 'dockerfile' also worked for me

@nromagno
Copy link
Author

@UlasKasim @ArifIstaka the name of the file is already capitalized.
Capture

@Muqito Can you clarify a little bit on how you "purged the settings and restarted." Thanks!

@Muqito
Copy link

Muqito commented Oct 27, 2020

@nromagno Sure thing.

Click on this little bug icon up to the right, and then you'll see the following settings:

purge-and-reset

I think I might have also reset to factory settings. Not sure though

@nromagno
Copy link
Author

@Muqito I purged the data and restarted as you described, but unfortunately the same error still appears.

@Kusanagi-2029
Copy link

@stephen-turner, @tonistiigi, @nromagno, Good afternoon! I am new to Docker. I try to run the image and container based on it by reading the Microsoft documentation step by step:
https://docs.microsoft.com/ru-ru/dotnet/core/docker/build-container?tabs=windows
But if I specify a Dockerfile without an extension, then I encounter an error reading Dockerfile by Docker itself (for some reason, it does not see the Dockerfile in this directory). When I specify the .txt extension (docker build -t counter-image -f Dockerfile.txt .
), Docker sees this file:
docker-error 5
docker-error 6
docker-error 8
docker-error 7

So do I not understand something due to lack of experience, or is there really some problem?

 Best regards, Kusanagi-2029

@bravecobra
Copy link

I just hit the same issue. I use the WSL2 engine, which is of course case-sensitive. The command sent to docker from Visual Studio is specifying a fully lowercase path, which breaks the command of course.

@llwydsj
Copy link

llwydsj commented Nov 1, 2020

I just hit the same issue. I use the WSL2 engine, which is of course case-sensitive. The command sent to docker from Visual Studio is specifying a fully lowercase path, which breaks the command of course.

Same here. Visual Studio debugging with Docker works fine. Output window shows:
>docker build -f "C:\dev\src\Project.Name\Dockerfile" args...
But building from the context menu when right clicking on the Dockerfile in the solution explorer executes this:
>docker build -f "c:\dev\src\project.name\dockerfile" args...

@bette
Copy link

bette commented Nov 4, 2020

This may help someone else:
The instructions say to make sure you are in the directory "node-bulletin-board/bulletin-board-app" and I was getting the above error when running in "node-bulletin-board". Changed into the bulletin-board-app child directory and it ran. Naturally I only re-read the doc after trying everything else.

@Pranav021
Copy link

Simply change name of "dockerfile" to "Dockerfile" and then build, it works for me.

@tonistiigi
Copy link
Member

tonistiigi commented Nov 9, 2020

These reports seem to be unique for windows. Afaics NTFS is a case-sensitive filesystem so I'm not sure how having Dockerfile in the wrong case producing an error could be a regression and not just an expected result. If someone can show the exact reproduction steps that show something that previously worked not working anymore in buildx it is possible we could do something about it or improve documentation.

edit: reading some more, apparently case-sensitivity is optional in NTFS (and some modern Windows don't use NTFS anymore). Assuming that is the underlying issue some investigation needs to be made why it worked previously (if it is a regression). It think it may be possible to have some exception to keep it working in buildx.

@stephen-turner
Copy link

I don't know if it's a regression from old build, but I would say that it's highly unexpected for dockerfile and Dockerfile to behave differently on a typical Windows machine.

@DanieleB89
Copy link

DanieleB89 commented Nov 13, 2020

image
even the tutorial in a fresh Docker Desktop installation fails...

@c0ri
Copy link

c0ri commented Nov 15, 2020

Same here:
failed to solve with frontend dockerfile.v0: failed to build LLB:
$ docker --version
Docker version 19.03.13, build 4484c46d9d

@tonistiigi
Copy link
Member

I don't know if it's a regression from old build, but I would say that it's highly unexpected for dockerfile and Dockerfile to behave differently on a typical Windows machine.

It's not too unexpected as I'm 99% sure that if you would just create a tarball of your build context and send it to the daemon (simplified version on how the API works) it would fail with any version of the builder. There is some preprocessing specifically for this file and that's why the casing is masked. For any other file referred to in Dockerfile no such exception exists as well. These are all linux container builds that are referred here and (common) Linux filesystems are case sensitive.

@pythiantech
Copy link

Same here:
failed to solve with frontend dockerfile.v0: failed to build LLB: error from sender: context created
Docker version:
Docker version 19.03.13, build 4484c46d9d

@tonistiigi
Copy link
Member

The solution is in #415 (comment)

@pythiantech
Copy link

The Dockerfile is named "Dockerfile". I have also tried purging and restarting but the issue persists.

@amankkg
Copy link

amankkg commented Nov 16, 2020

@tonistiigi file name is not the only issue here, or I have just another bug

Here is what I face when running docker build command:

failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``

Renaming "credsStore": "desktop.exe" to "credStore": "desktop.exe" in ~/.docker/config.json is what helped me actually, but it seems like Docker Destkop keeps adding credsStore entry in that config file

edit by @tonistiigi : please see #415 (comment) before following this advice

@mrmariush
Copy link

image
even the tutorial in a fresh Docker Desktop installation fails...

I had this same problem.
Just Sgin in in your Docker account

@nromagno
Copy link
Author

@llwydsj can you expand a little bit on your comment and the how you suggested to resolve this issue? I'm not familiar with Visual Studio, so how could I check if my issue also arises from case sensitivity. Thanks!

@tonistiigi
Copy link
Member

tonistiigi commented Nov 19, 2020

I did some digging and it turned out this was not even caused by the case-sensitivity of the filesystem. There is a special fallback moby/moby#10858 that allows name dockerfile when loading Dockerfile fails. It is only valid for dockerfile name, eg. dockerfilE will not work.

I've provided patches in buildx #444 and also in Dockerfile frontend in Buildkit moby/buildkit#1816 to maintain compatibility. Only one of them is needed to have the old behavior back.

@therealsohail
Copy link

Rename dockerfile to Dockerfile. Doing this fixed my issue.

@Devnol
Copy link

Devnol commented Jan 4, 2021

It only appears to only break if I attempt to cross-build for an architecture such as armv7 or anything that isn't x86/64

@Devnol
Copy link

Devnol commented Jan 4, 2021

I had that issue on my mac as well

@Peter-Schorn
Copy link

on macOS renaming "DockerFile" to "dockerfile" fixed the problem for me.

@Devnol
Copy link

Devnol commented Jan 9, 2021

My file was named "Dockerfile" and building only for amd64 with the default build system worked fine. When I used buildx to build for a different architecture it would error out.

@mariancraciun1983
Copy link

Another situation that I encountered was that .dockerignore was blocking the COPY . For example:

dockerfile:

FROM nginx:1.19.6-alpine as nginx
COPY ./Build/release/authenticator/conf/nginx.conf /etc/nginx/conf.d/default.conf

error:

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: failed to compute cache key: "/Build/release/authenticator/conf/nginx.conf" not found: not found

The solution was to add !/Build/release/authenticator/conf/nginx.conf in .dockerignore

@Xandrak
Copy link

Xandrak commented Jan 17, 2021

@tonistiigi file name is not the only issue here, or I have just another bug

Here is what I face when running docker build command:

failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``

Renaming "credsStore": "desktop.exe" to "credStore": "desktop.exe" in ~/.docker/config.json is what helped me actually, but it seems like Docker Destkop keeps adding credsStore entry in that config file

Crazy, this worked for me. Thanks!

Win 10 Pro WSL2 Ubuntu 20.04

@tonistiigi
Copy link
Member

No such thing as credStore config key. https://github.com/docker/cli/blob/master/cli/config/configfile/file.go#L37

@thaJeztah
Copy link
Member

Renaming credsStore to credStore would be the equivalent to removing the credsStore config (which makes docker skip the credentials-helper, and to store credentials as base64 encoded plain text in the configuration file).

@HamedNN76
Copy link

restarting docker worked for me

@ww9
Copy link

ww9 commented Jan 29, 2021

Deleting docker config file from inside WSL2 Ubuntu shell fixed it for me:

rm ~/.docker/config.json

I'm using Windows 10.

@rga2
Copy link

rga2 commented Jan 29, 2021

My issue was regarding the permissions to download the FROM image

I ran the docker build command as following:

sudo docker build -t myapp .

Also the docker file was named 'Dockerfile'

That worked for me

@jaroslavtyc
Copy link

Well, docker message is confusing.
In my case I just used invalid working directory (so I just have to cd to the right subdir with my Dockerfile).

Instead of explaining message like "No Dockerfile found, looked at current working directory /foo/bar" on my docker build --no-cache --tag jaroslavtyc/pb-web:8.0 . command I saw

[+] Building 0.0s (2/2) FINISHED                                                                                                                                                                                                        
 => [internal] load build definition from Dockerfile                                                                                                                                                                               0.0s
 => => transferring dockerfile: 2B                                                                                                                                                                                                 0.0s
 => CANCELED [internal] load .dockerignore                                                                                                                                                                                         0.0s
 => => transferring context:                                                                                                                                                                                                       0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount710040659/Dockerfile: no such file or directory

@James-sss
Copy link

Window 10 Home restart worked for me
Screenshot (79)

@mariusdkm
Copy link

For anyone stumbling across this issue on mac...
failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = failed to parse /Users/myusername/.docker/.token_seed: unexpected end of JSON input

I just deleted .token_seed and .token_seed.lock inside of /Users/myusename/.docker

@thaJeztah
Copy link
Member

@mariusdkm could you open a new ticket for that?

@JesielPalacios
Copy link

JesielPalacios commented Feb 20, 2021

Great..

$ docker build . -t spa-react:1.0
[+] Building 12.0s (8/12)
 => [internal] load build definition from Dockerfile                                                                                                                               0.9s 
 => => transferring dockerfile: 552B                                                                                                                                               0.0s 
 => [internal] load .dockerignore                                                                                                                                                  0.6s 
 => => transferring context: 2B                                                                                                                                                    0.0s 
 => [internal] load metadata for docker.io/library/nginx:1.19.6                                                                                                                    0.0s 
 => [internal] load metadata for docker.io/library/node:15.8.0                                                                                                                     0.0s 
 => [node-server 1/5] FROM docker.io/library/node:15.8.0                                                                                                                           0.0s 
 => ERROR [internal] load build context                                                                                                                                           11.0s 
 => => transferring context: 81.80MB                                                                                                                                              10.8s 
 => CACHED [client-app 1/2] FROM docker.io/library/nginx:1.19.6                                                                                                                    0.0s 
 => CACHED [node-server 2/5] WORKDIR /usr/src/app                                                                                                                                  0.0s 
------
 > [internal] load build context:
------
failed to solve with frontend dockerfile.v0: failed to build LLB: error from sender: open node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\_ts3.4\dist\ts-eslint-scope: Access is denied

@thaJeztah
Copy link
Member

@JesielPalacios looks unrelated; from the error it looks like you don't have permissions to read a file in your build context;

error from sender:
open node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\_ts3.4\dist\ts-eslint-scope:
Access is denied

see #415 (comment)

Note that other errors starting with failed to solve with frontend dockerfile.v0 may be unrelated; the failed to solve.. prefix is a generic prefix for this part of builds, and the errors after that are the underlying error,

@JesielPalacios
Copy link

@thaJeztah Mm.. i think that's weird, cause i'm working like administrator user and just trying to deploy an Angular App using the Multi-Stage Build feature from Docker.
I gonna need to get mor info on the internet about how to do it. If you got some info about it i'll be so gratefull to know it. Thanks!

@almontasser
Copy link

If you're working on wsl2 environment this worked for me: wsl --shutdown

@KAVA-Leigh
Copy link

For anyone stumbling across this issue on mac...
failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = failed to parse /Users/myusername/.docker/.token_seed: unexpected end of JSON input

I just deleted .token_seed and .token_seed.lock inside of /Users/myusename/.docker

@mariusdkm life saver! thank you.

@andrew-chang-dewitt
Copy link

@tonistiigi file name is not the only issue here, or I have just another bug

Here is what I face when running docker build command:

failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``

Renaming "credsStore": "desktop.exe" to "credStore": "desktop.exe" in ~/.docker/config.json is what helped me actually, but it seems like Docker Destkop keeps adding credsStore entry in that config file

This was my issue as well. Running Docker Desktop on WSL2. I just changed credsStore to credStore, so I haven't seen yet if it gets changed back, but I'll update here if it happens to me too. Seems like #444 didn't fix this issue entirely since credsStore vs credStore wasn't addressed in that PR.

  • Docker version 20.10.5, build 55c4c88
  • Windows 10 Pro Insider Preview, Build 21332.rs_prerelelease.210306-1859

@th5
Copy link

th5 commented Mar 25, 2021

I was having the "failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials" issue under Docker Desktop Windows/WSL2.

Running with sudo worked for me.

@antoniobarquero
Copy link

Estoy siguiendo los pasos para usar Docker y me salta este error al ejecutar el comando : docker build -t captacion-php ./

[+] Building 0.3s (2/2) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 4: unknown instruction: LIBMCRYPT-DEV

¿me echáis una mano? gracias!

@0123hoang
Copy link

If i run docker build with build kit (DOCKER_BUILDKIT=1 docker build -t base .), the error occurs.
I simply remove that params (docker build -t base .) and its works.

@subiron
Copy link

subiron commented Apr 9, 2021

in my case adding tag after image name resolved the issue.
FROM nginx to FROM nginx:latest

@abexamir
Copy link

abexamir commented Apr 29, 2021

There's a problem with your Dockerfile; maybe some of the Dockerfile-specific lines contain illegal words. for example, you may have a line like this:
EXPOSE 3000 # lorem Ipsum blah blah
that part after # is not treated as a comment, and it ruins the Dockerfile syntax.

@zsjohny
Copy link

zsjohny commented Apr 30, 2021

Please note at which build stage the error was reported

@ATpoint
Copy link

ATpoint commented May 4, 2021

For me none of the above helped, but to repeat the docker login process did the trick.

@thaJeztah
Copy link
Member

I am locking the conversation on this ticket, because it's collecting many comments that are unrelated to the original issue, but let me describe some steps that may help users arriving here.

Reading the errors produced during build

The error messages returned by current versions of Docker when using BuildKit can be rather verbose, and many will start with the same prefix (failed to solve.. ). The errors that are printed are a colon (:) separated chain of errors from BuildKit's subsystems that are involved in processing the build. The exact errors may differ slightly between versions of Docker, and depending on what "subsystem" the error occurs in, but generally follow the same pattern.

If you get such an error, be sure to read the whole error message; the underlying error is usually at the end. Some examples from the discussion above;

Example 1

failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``

The above error can be split to:

(1) failed to solve with frontend dockerfile.v0:
(2) failed to build LLB: failed to load cache key:
(3) rpc error: code = Unknown desc = error getting credentials - err:
(4) exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``

Where (4) is the underlying error that caused the problem (in this case the client is configured to use the docker-credential-desktop.exe credentials-helper, which is not accessible from the WSL2 environment (#415 (comment)). (1) .. (3) are the BuildKit components that are affected by the underlying problem (the gRPC API, the code constructing the BuildKit "LLB" graph, and the Dockerfile frontend / parser.

Example 2

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to build LLB: Error processing tar file(exit status 1): unexpected EOF
(1) failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0:
(2) failed to build LLB:
(3) Error processing tar file(exit status 1): unexpected EOF

Here, the underlying error is (3), and happened when handling a tar file (without further context / details it's hard to tell what the cause ise, but could be (for example) when using ADD to add a remove tar-archive, and there was a networking issue, the server had an issue, or the file that's added is not in the right format).

Example 3

failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount840562661/dockerfile: no such file or directory
(1) failed to solve with frontend dockerfile.v0:
(2) failed to read dockerfile:
(3) open /var/lib/docker/tmp/buildkit-mount840562661/dockerfile:
(4) no such file or directory

Here, (2)...(4) describe that docker / BuildKit was unable to load the Dockerfile. This looks like the issue that was originally reported, and was related to situations where the Dockerfile was named dockerfile (lowercase); fixes for this were merged (#415 (comment)).

Example 4

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: failed to compute cache key: "/Build/release/authenticator/conf/nginx.conf" not found: not found
(1) failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0:
(2) failed to solve with frontend gateway.v0:
(3) rpc error: code = Unknown desc = failed to build LLB:
(4) failed to compute cache key: "/Build/release/authenticator/conf/nginx.conf" not found:
(5) not found

The not found is a bit duplicate here (see moby/buildkit#2047), but the underlying error is that the nginx.conf file is not present on your client, is excluded by .dockerignore, or (depending on your setup) could be referenced using the wrong "casing" (uppercase/lowercase); double check that the file exists, that it's not excluded by a .dockerignore file, that it's readable by the current user, and if the path is correct and has the correct casing.

Example 5

failed to solve with frontend dockerfile.v0: failed to build LLB: error from sender: open node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\_ts3.4\dist\ts-eslint-scope: Access is denied
(1) failed to solve with frontend dockerfile.v0:
(2) failed to build LLB:
(3) error from sender:
(4) open node_modules\eslint-plugin-testing-library\node_modules\@typescript-eslint\experimental-utils\_ts3.4\dist\ts-eslint-scope:
(5) Access is denied

Here the error looks to be on the "client" (cli) side: the docker / buildkit daemon requested the CLI to send a file, but the user running the client did not have access to the file or directory.

Note that filesystem errors (e.g. "Access is denied") may differ between operating systems, and the error message can sometimes be somewhat misleading; they should give you a starting point to debug (and hopefully solve) what's wrong in your situation though.

Example 6

failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 4: unknown instruction: LIBMCRYPT-DEV
(1) failed to solve with frontend dockerfile.v0:
(2) failed to create LLB definition:
(3) dockerfile parse error line 4:
(4) unknown instruction: LIBMCRYPT-DEV

This error is a syntax error in the Dockerfile; make sure you didn't miss (for example) a line-continuation (\) marker; I expect LIBMCRYPT-DEV was part of a RUN ... line, but due to a missing line-continuation marker, the Dockerfile parser attempted to read it as a Dockerfile instruction, instead of as part of the RUN instruction.

But these errors are so hard to read!

Yes, some of these errors are horrible; they're often too verbose and while the extra information may help us to find in what part / subsystem of the build process the error is occurring, they can be daunting for users.

We're looking at improving these errors to make the more readable. For example: moby/moby#42329 (comment) shows an improved error message when using Buildx;

Dockerfile:3
--------------------
   1 |     # syntax=docker/dockerfile-upstream:master
   2 |     FROM busybox
   3 | >>> RUNCMD
   4 |
--------------------
error: failed to solve: rpc error: code = Unknown desc = failed to create LLB definition: dockerfile parse error line 3: unknown instruction: RUNCMD

But further improvements will still be made.

I hope the above helps users that run into errors to narrow down the cause. If you run into an issue, and still think there's a bug, feel free to open a new ticket, but (as may be clear from the above) make sure to include details about the issue, and provide the exact steps to reproduce (taking into account that maintainers of this project do not have access to your private GitHub and Docker Hub repositories).

@docker docker locked as resolved and limited conversation to collaborators May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.