An error, "failed to solve with frontend dockerfile.v0"

DockerDocker ComposeDockerfileGatsby

Docker Problem Overview

I was trying to build my Docker image for my Gatsby application. Whenever I run the command docker build . -t gatsbyapp, it gives me an error:

failed to solve with frontend dockerfile.v0: failed to build LLB:
failed to compute cache key: "/.env" not found: not found

Meanwhile my Dockerfile is shown below:

FROM node:13


COPY package.json .

RUN yarn global add gatsby-cli

RUN yarn install

COPY gatsby-config.js .

COPY .env .


CMD ["gatsby","develop","-H",""]

Docker Solutions

Solution 1 - Docker

I had experienced this issue after upgrading to the latest Docker Desktop version on Mac. Solved with the comment on this issue.

Solution: Don't use buildkit and it works for me.


Solution 2 - Docker

I had the same issue and all I had to do was to capitalize the Docker configuration filename:

dockerfile > didn't work

Dockerfile > did work

Solution 3 - Docker

Probably not the problem the OP had, but I had this issue while trying to build my container running inside Windows Subsystem for Linux (WSL) (Debian WSL2), just after having freshly installed Docker Compose and all I had to do was close the (Debian) terminal and reopen it and my issue was solved.

Solution 4 - Docker

If you are seeing this issue it is not actually the real issue. The actual issue is nested in the error logs somewhere. To see the actual issue you need to run your build command like this:

DOCKER_BUILDKIT=0  docker build .

Notice the DOCKER_BUILDKIT=0. That will make the build kit not hide the nested error. From there you should be able to google the correct solution.

This will also make the build look different in command line, but don't worry about that. Just look for the error.

Solution 5 - Docker

If you are using Docker Desktop, restarting Docker worked for me. TroubleshootRestart

Solution 6 - Docker

If you use Docker for Windows you need to disable buildkit. It works for me.

Set buildkit option to false.

  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
  "experimental": false,
  "features": {
    "buildkit": false

Docker for Windows buildkit option

Solution 7 - Docker

I have the same issue.

Docker filename:

  • DockerFile - error
  • dockerFile - error
  • Dockerfile - work!

You need only one capitalized character.

Solution 8 - Docker

In my case I was trying to copy over folder wp-content from my current directory, inside the Docker image I was building. Like so:

FROM wordpress:latest

# Copy wp-content
COPY ./wp-content/ ./var/www/html/wp-content/

However, I noticed that I had a .dockerignore file, which explicitly was told to ignore wp-content.

When I removed wp-content/ from .dockerignore it worked fine.

Solution 9 - Docker

Disable the macOS v11 (Big Sur) virtualization framework:

Enter image description here

Solution 10 - Docker

In my case, I had an extra space after "." in the context option:

docker build -t myapp .[EXTRA_SPACE_HERE]

Solution 11 - Docker

Make sure your .dockerignore doesn't match your file.

A pattern sometimes used with .dockerignore is to add a wildcard to it and exclude the specifically expected file to the context with !filename syntax. EG:


If you later try to use a file in Dockerfile it will match the wildcard and not be present in the context. Add an exception to the new file or remove the wildcard to fix this.

Solution 12 - Docker

If you are using Docker Desktop for Mac or Windows, you might have to also disable it in your 'Docker Engine' JSON configuration.

Docker Desktop → SettingsDocker Engine → change the "features": { buildkit: true} to "features": { buildkit: false}.

Solution 13 - Docker

I don't remember where exactly I read this, but if you are using WSL2 and receive that error, then delete the Docker configuration file in your WSL2 home folder and try to rebuild your image.

That is if you have already checked your file names and reconfirmed that everything is named correctly (Dockerfile, .dockerignore, etc.)

WSL2 Ubuntu:

rm ~/.docker/config.json

Solution 14 - Docker

In my case

> failed to solve with frontend dockerfile.v0: failed to create LLB definition: no build stage in current context

was caused by setting ENV before FROM. Probably this is not allowed for some Dockerfile instructions. After moving ENV right after FROM the error is gone.

Solution 15 - Docker

I got this issue when I'd run out of disk space, presumably exacerbated by the numerous image layer caches building up as I teased and tweaked my Dockerfile.

Solution 16 - Docker

I had to set "credsStore": "" in my ~/.docker/config.json .... It was previously set to credentials.exe.

In WSL2 ddev start fails at docker-credential-desktop.exe, "error listing credentials" #2342

Solution 17 - Docker

I faced the issue due to VPN connectivity.

All I had to do was set a manual proxy in the Docker Desktop PROXIES section:

Enter image description here

Solution 18 - Docker

In my case, I had two problems:

  1. I missed the . in the end of the command that gives the context option, and
  2. I have a ".txt" extension in the file name of the Dockerfile.

After these two adjustments, all worked as expected.

Solution 19 - Docker

Sometimes this kind of error comes from a stupid syntax error... In my case I modified a Dockerfile and removed some environment variables, but forgot to take off the backslash from the last line...

    WORDPRESS_SKIP_INSTALL="yes" \ <-- to be removed

EXPOSE 8080 8443

Solution 20 - Docker

Had a typo,

FROM apline:3.7 instead of FROM alpine:3.7

Solution 21 - Docker

For me the following was the error:

> failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to do request: Head net/http: TLS handshake timeout

I am using WSL2 in Windows 10 and Docker Desktop and I got this issue after updating the Docker Desktop to version 3.5.

I fixed the issue by enabling the WSL integration with additional distributions.

To enable it:

Open Docker Desktop in Windows and go to settingsResourcesWSL IntegrationEnable integration with additional distributions and enable it for the Ubuntu application that you installed.

Solution 22 - Docker

I had the same error, but by moving the Dockerfile out of the sub-folder and into the root folder of my application. It fixed the error message.

Solution 23 - Docker

If you use Docker for Windows, then be sure that the Docker engine is set to the mode matching the image you want to build (Windows / Linux).

Solution 24 - Docker

I had the same issue while building a Docker image through Visual Studio 2019. My Docker file had a name like Dockerfile.

Dockerfile > didn't work

dockerfile > did work

Solution 25 - Docker

Chiming in with another possibility that happened to me: If you're using build stages, make sure that you have the right stage names throughout.

I had a stage defined with

FROM zzz AS development

that was later used for another stage

FROM development AS yyy

On a whim I changed development to dev, but only in the first instance. So the latter one was still FROM development while the former was AS dev.

Odd how arcane the error message is for a such a minor mistake... You'd think they could just have the error message say "couldn't find development" or something.

Solution 26 - Docker

Make sure that you are using the same platforms, e.g. if you build the first image (my-custom-service) with

FROM --platform=linux/amd64 node:14

then you need to add the --platform to other Dockerfiles that use the baseimage of the first:

FROM --platform=linux/amd64 my-custom-service

Solution 27 - Docker

I ran into this problem using WSL2 Ubuntu, and I fixed it by changing the permissions of the Dockerfile.

When I set up WSL2 on my computer I copied some of my files (including the Dockerfile) directly from Windows into the Ubuntu root folder, which apparently results in files with blank permissions:

---------- 1 user user 10M Jan 1 00:00 Dockerfile

To fix it I ran chmod 644 Dockerfile:

-rw-r--r-- 1 user user 10M Jan 1 00:00 Dockerfile

And after that Docker was able to build the image without any further issue.

Solution 28 - Docker

In case your docker file is in a different path with different name than Dockerfile you can run

docker build -t build_tag_name -f './path/to/dockerfile/exampledockerfile' .

Solution 29 - Docker

In my case, this was because of the under-expressed use cases from documents. almost all examples tell you to use . and Dockerfile (capital D) but mostly does not tell explicitly how to customize.

docker image build --tag any_image_tag --file any_file_name path_to_your_context_folder

This one is better in my opinion, and I hope will help those coming here. any_file_name is really any file name with build instructions in it, "dockerfile" in it is not needed but helps to identify and give full path if it differs from context folder. path_to_your_context_folder is basically where your work resides, such as a web app.

for example, the following is my current test in windows where COPY . /app uses context folder as the .:

docker image build --tag nested_image --file C:\WorkSpace\myapp\dockerfiles\any_file_name C:\WorkSpace\myapp\contextfiles\

PS: The topic really has interesting answers to the same problem but by lots of exotic causes. mine is just a side note to a hidden-in-plain-sight problem.

Solution 30 - Docker

In my case, I had 2 images, and I was copying from the same image. My specific error was: failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: circular dependency detected on stage: kubexit

FROM karlkfi/kubexit:latest AS kubexit
COPY --from=kubexit /bin/kubexit /bin/

FROM maven:3.8-jdk-11-slim AS build

So it was a circular reference. The fix:

FROM karlkfi/kubexit:latest AS kubexit

FROM maven:3.8-jdk-11-slim AS build
COPY --from=kubexit /bin/kubexit /bin/

Solution 31 - Docker

If you are using Windows Subsystem for Linux (WSL), check if Docker is running before you launch the window. If you have started Docker after starting the window. Then Just restart your terminal. And it should work if your file is correct.

Solution 32 - Docker

Specify the proxy server by setting the HTTP_PROYY and HTTP_PROXYS environment variables.


http_proxy=http://username:[email protected]:8080
https_proxy=http://username:[email protected]:8080

Solution 33 - Docker

As far as I can see, this error can have many reasons.

In my case, there were two errors: (1) in the Dockerfile: the # syntax = ***** line was incorrectly spelled out and (2) in file docker_compose.yaml, the web / build: * line was pointing to the wrong directory.

I was helped by reading the Dockerfile documentation and taking a break to regain attention.

Solution 34 - Docker

I've had this issue/error before when I had a script that I used to build multiple Dockerfiles and where one of the Dockerfiles was commented out. Once I uncommented the Dockerfile and run the script again it worked fine for me.

Solution 35 - Docker

In case you have a similar project structure

├── docker                   
│   │
│   ├── app
│   │   └── Dockerfile
│   └── mlflow  
│       └── Dockerfile
└── docker-compose.yml

you might be missing to specify the build: context in the docker-compose.yml

version: '3'


      context: ./
      dockerfile: ./docker/mlflow/Dockerfile
    container_name: ml_app_mlflow
      - ./db:/db
      - 5000:5000

Solution 36 - Docker

In case you previously executed docker buildx install, your docker command is aliased to docker buildx, which is based on Docker Buildkit, which is currently not supported (sadly) for Windows containers.

To remove the alias, execute the following command:

docker buildx uninstall

I hope that will save time to people like me, who forgot about this alias

Solution 37 - Docker

For me, I found that I was trying to build from the wrong directory.

Solution 38 - Docker

In my case I was not in the same directory as the dockerfile itself

Solution 39 - Docker

Try with this simple solution, name your dockerfile like this Dockerfile with no extension.

Solution 40 - Docker

In my case, I had to uninstall Astrill VPN.


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMuhammad YasirView Question on Stackoverflow
Solution 1 - DockerEsteban GatjensView Answer on Stackoverflow
Solution 2 - DockerLuis GouveiaView Answer on Stackoverflow
Solution 3 - DockerjeffrescView Answer on Stackoverflow
Solution 4 - DockerSamuel ThompsonView Answer on Stackoverflow
Solution 5 - DockerMadupoornaView Answer on Stackoverflow
Solution 6 - Dockerdima_horrorView Answer on Stackoverflow
Solution 7 - DockerLiar РonestView Answer on Stackoverflow
Solution 8 - DockerFooBarView Answer on Stackoverflow
Solution 9 - DockerTudorView Answer on Stackoverflow
Solution 10 - DockerBilal ChView Answer on Stackoverflow
Solution 11 - DockerchicocvenancioView Answer on Stackoverflow
Solution 12 - DockerSamuel Tosan AyoView Answer on Stackoverflow
Solution 13 - DockerGeorgi YanevView Answer on Stackoverflow
Solution 14 - DockersarhView Answer on Stackoverflow
Solution 15 - DockerClaire FurneyView Answer on Stackoverflow
Solution 16 - DockerMohamed YousefView Answer on Stackoverflow
Solution 17 - DockerAbhishek D KView Answer on Stackoverflow
Solution 18 - DockerEd_WFerreiraView Answer on Stackoverflow
Solution 19 - DockerFrancoisView Answer on Stackoverflow
Solution 20 - DockertechkuzView Answer on Stackoverflow
Solution 21 - DockerVishnu KRView Answer on Stackoverflow
Solution 22 - DockerSebastianView Answer on Stackoverflow
Solution 23 - DockerEricView Answer on Stackoverflow
Solution 24 - DockerMadanDView Answer on Stackoverflow
Solution 25 - DockerrococoView Answer on Stackoverflow
Solution 26 - DockerJoeView Answer on Stackoverflow
Solution 27 - DockerJames DouglasView Answer on Stackoverflow
Solution 28 - DockerAffes SalemView Answer on Stackoverflow
Solution 29 - DockerYılmaz DurmazView Answer on Stackoverflow
Solution 30 - DockertomView Answer on Stackoverflow
Solution 31 - DockerAvinalView Answer on Stackoverflow
Solution 32 - Dockersos418View Answer on Stackoverflow
Solution 33 - DockerkokserekView Answer on Stackoverflow
Solution 34 - DockerOpenBSDNinjaView Answer on Stackoverflow
Solution 35 - DockerMiguel TrejoView Answer on Stackoverflow
Solution 36 - DockerMeir GabayView Answer on Stackoverflow
Solution 37 - DockerCyebukayireView Answer on Stackoverflow
Solution 38 - DockerfruitbatinshadesView Answer on Stackoverflow
Solution 39 - DockerAhmer SaeedView Answer on Stackoverflow
Solution 40 - DockerZhefengJinView Answer on Stackoverflow