Unable To Prepare Context: Docker File Error….

I am trying to get my hands wet with Docker. To create a new docker build, I was creating docker file. But while running the Docker Build command, I got the following error,

Now, since I am learning this stuff, the error seemed like something really terribly had gone wrong. Search over Google mentioned couple of things, like check if you have made the file with Notepad, it will add a .txt extension and that’s not acceptable. For me it wasn’t the case. I didn’t use Notepad but Ubuntu’s Nano editor.

So what was the issue? Well, pretty simple one. Docker file must be named as Dockerfile. If the file is named anything else, it’s not accepted. And if we check, my file name was DockerFile. So I changed that and it worked.

So do pay attention to the file name. It matters.

Hope that helps.