Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

237
Vistas
failed to solve with frontend dockerfile

I am pretty new to Docker and trying to build docker image with plain html but i have this error message, saying failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount602954594/Dockerfile: no such file or directory

My folder directory is like this

C:\Users\hailey\Desktop\GitTest
                               |- Dockerfile.txt
                               |- README.md
                               |- testHelloWorld.html

Inside of the Dockerfile, I have

FROM ubuntu  
WORKDIR C/Users/hailey/Desktop/GitTest
COPY testHelloWorld.html .
EXPOSE 8080
CMD ["html","testHelloWorld.html"]

I did my command docker build . inside of the directory C:\Users\hailey\Desktop\GitTest. then got

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

Does anyone have any other what I did wrong?

11 months ago · Santiago Trujillo
14 Respuestas
Responde la pregunta

0

For those who use docker-compose build also make sure you have properly set build path in docker-compose.yml:

version: '3.8'

services:
  web:
    build: ./services/web/ --> this folder should contain your Dockerfile, otherwise you will have the above error
11 months ago · Santiago Trujillo Denunciar

0

Make sure you are in the correct directory first, and docker desktop is running.

11 months ago · Santiago Trujillo Denunciar

0

I got the same error: It could be anything. Mine wasn't anything specific.. I had incorrectly named and referenced one of the files in the configs so when trying to run build it could not find that file.

It had nothing to do with frontend dockerfile.v0 (totally different file), check all your file are name and referenced correctly.

11 months ago · Santiago Trujillo Denunciar

0

The issue in my case was, file name was correct but the extension was txt. What I did is , opened notepad++ and pasted this FROM mcr.microsoft.com/dotnet/aspnet:3.1 line and after that saved that file from notepad++ like below

enter image description here

once the file is saved it will look like below

enter image description here

11 months ago · Santiago Trujillo Denunciar

0

One can provide the filename of the docker file using -f.

For instance, if your docker file is called Dockerfile.base, call the build command as follows:

docker build . -f Dockerfile.base -t helloworld

Then, you can start the build image using following command:

docker run --rm -it helloworld
11 months ago · Santiago Trujillo Denunciar

0

You really need to use buildkit? if not:

Try to set those .envs before executing your build/docker composer:

export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0
11 months ago · Santiago Trujillo Denunciar

0

The name of docker files has no extension, it's just Dockerfile with capital D and lowercase f

You can also specify the Dockerfile name such as docker build . -f Dockerfile.txt if you'd like to name it something else

11 months ago · Santiago Trujillo Denunciar

0

I ran into similar issue while building a Visual Studio 2019 generated docker file.

>>failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount037306220/dockerfile: no such file or directory

Essentially the docker file is being referred from within the Windows Subsystem for Linux ( WSL). The tool mounted my local file system and is accessing the docker file in context of WSL. As file names are case sensitive on Linux, the docker command faithfully reported the error:

>> dockerfile: no such file or directory

Renaming the Dockerfile to "dockerfile" resolved the issue.

11 months ago · Santiago Trujillo Denunciar

0

I had the same issue running "docker build -t getting-started ." from Visual Studio Code terminal.

But when I've executed the same command in CMD(Windows 10) it worked with no problems.

11 months ago · Santiago Trujillo Denunciar

0

I would like to sum up the information from different answers in one answer, and also add my own experience that brought me to this question:

  1. Ensure that you're in the same directory that contains your dockerfile as where you're running your command from (running ls or dir depending on if you're using Linux or Windows/cmd shell respectively to determine if the file you'll use to build your docker container exists there)
  2. Docker will accept at least two (maybe only two?) default names for dockerfiles: dockerfile and Dockerfile. If you have other capitals in the filename it will most likely fail. Also note that the default filenames have no file extension (so if you're to create the file in Notepad for instance, it may be a .txt or another extension by default). There is another answer here that shows how to save it without a filename from notepad, but you can also use the following commands in Linux and Windows command prompt, respectively:
    mv dockerfile.txt dockerfile
    ren dockerfile.txt dockerfile
  3. If you need to use a different name instead of the default dockerfile/Dockerfile, then you can use the option -f (link to docs), which states:

-f, --file string Name of the Dockerfile (Default is 'PATH/Dockerfile')

Taken from another answer, here's an example of how you can use that command:

  docker build . -f Dockerfile.base -t helloworld

And just to bring it all together, you don't need to use the filename again once the container is built, so you can just run it with:

docker run --rm -it helloworld
11 months ago · Santiago Trujillo Denunciar

0

I just this same issue, turned out I had to place the docker file in right folder--the root project folder.

11 months ago · Santiago Trujillo Denunciar

0

I had the same issue Working with react app. I had to move the Dockerfile from src to the project root folder and restarted docker desktop...it worked.

11 months ago · Santiago Trujillo Denunciar

0

Make sure you see the list using "ls" or "dir" command.

In my case I create Dockerfile using Mac's Textedit and it had a hidden .rtf extension.

After removing the extension it worked.

11 months ago · Santiago Trujillo Denunciar

0

Check the name of Dockerfile it should be "Dockerfile"

11 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos