Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant create image/ the Dockerfile (Dockerfile) cannot be empty

I am taking a beginner course and not able to create an image on terminal.

Here is the course I am taking(Sorry, the course is in Japanese course but just for the reference). I am at 1:01:39 where he proceeds to create docker image.

First, the error message contained Failed to solve with frontend docker file.v0:failed to create LLB definition:the Dockerfile cannot be empty

I ran below command and managed to get rid of Failed to solve with frontend docker file.v0:failed to create LLB definition (Failed To Resolve With FrontEnd DockerFIle.v0):

export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0

Now I'm left with the Dockerfile cannot be empty

I saw in some page that people fail to locate because of not capitalized dockerfile but that's not my case.

enter image description here

I have also tried -f on the command to direct file

enter image description here

like image 412
chiyochinita Avatar asked Jul 12 '26 02:07

chiyochinita


2 Answers

I saw that you, don't save your dockerfile, try save changes and run docker build again.

Also saw same issue on github, it could be helpful

Try to change COPY to ADD

https://github.com/docker/compose/issues/5170

like image 140
Makariy Avatar answered Jul 14 '26 07:07

Makariy


In VS-Code unless you save the file, it won't work. So try to save it first and then it will work.I faced the same issue, after saving the file it worked. Maybe at times when file is not saved the terminal consider the previous version of the file.

like image 27
Tarush Mihir Avatar answered Jul 14 '26 05:07

Tarush Mihir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!