Visual Studio Code (1.22.2) offers a file extension named .dockerfile
in the the save dialog. What is a file with this extension? A Dockerfile is in all documentation and examples, that I've seen so far, only called Dockerfile
.
If I enter Dockerfile
as a file name, a file named Dockerfile.dockerfile
is created.
A Dockerfile must be created with no extension. To do this in Windows, create the file with your editor of choice, then save it with the notation "Dockerfile" (including the quotes).
The Dockerfile is used to build images while the docker-compose. yaml file is used to run images. The Dockerfile uses the docker build command, while the docker-compose. yaml file uses the docker-compose up command.
Go language is used to write Docker. A Dockerfile is a text file that contains collections of instructions and commands that will be automatically executed in sequence in the docker environment for building a new docker image.
You can use docker build or the predefined make build-extension command to build the extension. The previous command generates a Docker image named after the Docker Hub repository you provided to the init command. For this guide, we're using john/my-extension .
It appears that "*.dockerfile" is simply an alternative to the conventional "Dockerfile" name. This is perhaps useful if you want to keep a collection of dockerfiles in the same directory. Note the -f/--file
option in docker help build
:
-f, --file string Name of the Dockerfile (Default is 'PATH/Dockerfile')
In other words, you are not required to use the name "Dockerfile", and the VSCode extension will correctly syntax-highlight any file ending in ".dockerfile".
Using the .dockerfile extension tells VSCode that the file is a DockerFile for code highlighting and linting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With