Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

When to make a comment in a dockerfile?


Asked by Sincere Dawson on Dec 02, 2021 FAQ



Docker treats lines that begin with # as a comment, unless the line is a valid parser directive. A # marker anywhere else in a line is treated as an argument.
Similarly,
Docker - File 1 Step 1 . Please note that the name of the file has to be "Dockerfile" with "D" as capital. 2 Step 2 . The first line " 3 This is a sample Image" is a comment. ... The next line has to start with the FROM keyword. 4 Step 3 . In the next chapter, we will discuss how to build the image. More ...
Keeping this in consideration, The commands in the Dockerfile are vital to building a Docker image. Every line of command in the Dockerfile creates the layers that make up the Docker image. Provided the Dockerfile remains the same, every time you build an image off it, it’s certain you’d get the same results.
Subsequently,
Every line of command in the Dockerfile creates the layers that make up the Docker image. Provided the Dockerfile remains the same, every time you build an image off it, it’s certain you’d get the same results. However, when you add a new line of command, Docker simply builds that layer and adds it to the existing layers.
Additionally,
1 The first line "#This is a sample Image" is a comment. ... 2 The next line has to start with the FROM keyword. ... 3 The next command is the person who is going to maintain this image. ... 4 The RUN command is used to run instructions against the image. ... 5 The last command is used to display a message to the user.