Back
Dockerfile on Windows
This week I started learning to use docker and I submitted a pull request to update their documentation.
I found the Dockerfile step to be unclear and added an image to hopefully clarify how to create a Dockerfile on windows.
I originally thought that it would be similar to gitignore files where you needed a period before and after the word gitignore. After reading a few articles and skimming a few videos, I saw that everyone skipped the explanation of how to create a Dockerfile on Windows.
Then, I created a Dockerfile in a Linux environment on Windows Subsystem for Linux using touch Dockerfile. This made think, “Wow, Linux allows files without extensions.” I went back to my Windows computer to duplicate it.
I could not think of how to create an extension-less file on Windows. I’ve been using Windows for a while and have used various versions such as 95, 98, NT, ME all the way to the modern version 10. I couldn’t think of any file that I have seen without an extension. So, I used my git terminal to create the file. Again, I used touch Dockerfile.
Dockerfile (file without an extension)
When I opened File Explorer, to see what was created, it was literally a file without an extension 🤯. I deleted the file, right clicked into New -> Text Document, and type ‘Dockerfile’ (without an extension) and Voilà!!! A Dockerfile was created 😎.
Of course, I felt obligated to share this discovery with future newcomers to Docker who may have the same issue. Therefore, I created an issue (Issue #8933: Include image of files to make Dockerfile type clear) and pull request to add this image to its documentation. I am keeping my fingers crossed 🤞🏿 and hoping that this gets approved.