The Linux Page

failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to create LLB definition: no build stage in current context

Broken Dockerfile generates this strange error which means roughly nothing.

Docker is still a very strange beast to me and some of the errors it generates are even stranger.

Today I got this one:

failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to create LLB definition: no build stage in current context

which means roughly nothing to a normal human being.

The fact is that it happens when there is an error in the setup.

In my case, I added this line:

ENV BUILDKIT_PROGRESS=plain

before this one:

FROM ...

and as a result got that message as shown above.

I've found a post which mentioned the same error and the people mentioned several different types of errors:

  • The "Dockerfile" was spelled differently such as "dockerfile" or "DockerFile".
  • The docker build ... command needs to be run in a specific folder.
  • Some settings may not the be reset (if you build on Docker.io, at least).
  • If you have a ~/.docker/config.json file, the parameters in that file may be invalid (for example "credStore" could be written "credentialsStore".
  • You may need to be logged in some account.
  • Trying to build from your $HOME directory. Move your data in a sub-folder.
  • The BUILDKIT may be in the way.

Source: dockerfile.v0 error