12

No matter what I try to build via the terminal docker has the exact same error below. I cannot figure out what is going wrong or where to even start to fix this. Thanks in advance for anyone who can tell me whats going wrong.

[+] Building 0.0s (2/2) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 2B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount365162480/Dockerfile: no such file or directory 
3
  • We need more context, how do you run this ? Commented Oct 16, 2020 at 4:23
  • I run 'docker build <dir>' from the terminal, with the DockerFile inside the <dir>. No matter how simple the dockerfile, no matter where the location, the build finishes as shown but then this same error occurs. Commented Oct 16, 2020 at 5:20
  • Tried to CD and run with . ? Commented Oct 17, 2020 at 6:18

3 Answers 3

59

Frustratingly I hit this today after resetting my Docker Desktop Community edition (on Windows) to factory defaults. Builds were working fine before I did this. Anyway I saw this post and then found elsewhere (https://github.com/docker/buildx/issues/410) a reference to release notes for latest Docker version and the suggestion to disable buildkit:

Docker Desktop now enables BuildKit by default after a reset to factory defaults. To revert to the old docker build experience, go to Preferences > Docker Engine and then disable the BuildKit feature.

So I went to the Docker Engine screen and edited the config file

{ "registry-mirrors": [], "insecure-registries": [], "debug": false, "experimental": false, "features": { "buildkit": true } } 

changing the buildkit entry to false and then just clicked apply and restart.

So it looks like an issue for certain Windows builds right now!

Hopefully this will get you working again.

Sign up to request clarification or add additional context in comments.

1 Comment

this is a ridiculous error, thanks so much for finding it. how on earth is this the default value??? I am struggling to see what purpose this even serves
1

The error is only related to not finding the Docker file due to name differences. I've found the following encounters ppl had:

  • File is named dockerfile or dockerFile but filename should be Dockerfile
  • File is named Dockerfile.txt instead of just Dockerfile (no extension)
  • File is named Dockerfile but VS searches for dockerfile (see my screenshot below).

If the last thing is your issue, then rename it to "dockerfile" or find a way how to overwrite the -f command. I can reproduce it when i click "rebuild" on my Dockerfile in VS2019. enter image description here

Good luck!

Comments

0

This error also occurs when there is no Dockerfile available to Docker, i.e it isn't called Dockerfile or you either didn't specify it with the -f option.

Make sure to be in the correct repo. See the official Docker documentation for more info.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.