Multiline comments in Dockerfiles

As of today, no.

According to Dockerfile reference documentation:

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

There is no further details on how to comment lines.

As said by some comments already, most IDE will allow you to perform multiline comments easily (such as CTRL + / on IntelliJ)


There is no mentioning of multiline comments in Docker documentation

I also paste here the relevant part for simplicity:

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.
This allows statements like:

# Comment  
RUN echo 'we are running some # of cool things'  

Line continuation characters are not supported in comments.

On the other hand you can achieve the requested result easily with any modern IDE / Text Editor.

This is an example using Sublime Text (Select text and then control + /).

You can achieve the same result with VsCode, Notepad++, JetBrains products (IntelliJ, PyCharm, PHPStorm etc.) and almost 100% of the IDEs / Text Editors I know and use.

enter image description here