Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the .dockerfile extension?

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.

enter image description here

If I enter Dockerfile as a file name, a file named Dockerfile.dockerfile is created.

like image 649
deamon Avatar asked Apr 26 '18 12:04

deamon


People also ask

What is the Docker file extension?

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).

Is Dockerfile a Yaml file?

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.

What are Dockerfiles written in?

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.

How do I create a Docker extension?

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 .


2 Answers

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".

like image 63
gwk Avatar answered Oct 17 '22 08:10

gwk


Using the .dockerfile extension tells VSCode that the file is a DockerFile for code highlighting and linting

like image 28
Wolfe Avatar answered Oct 17 '22 08:10

Wolfe