Docker has the same error regardless of what I try to build (windows 10)

Viewed 12223

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 Answers

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.

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!

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.

Related