Multiline comments in Dockerfiles Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Docker updating image along when dockerfile changesUsing the RUN instruction in a Dockerfile with 'source' does not workWhat is the difference between CMD and ENTRYPOINT in a Dockerfile?Clone private git repo with dockerfileWhat is the difference between the `COPY` and `ADD` commands in a Dockerfile?How to write commands with multiple lines in Dockerfile while preserving the new lines?How do I make a comment in a Dockerfile?Multiple RUN vs. single chained RUN in Dockerfile, what is better?Creating bash script from Dockerfile strips commentsHow to specify working directory for ENTRYPOINT in Dockerfile

How to align enumerate environment inside description environment

Printing attributes of selection in ArcPy?

Is it dangerous to install hacking tools on my private linux machine?

Simple Http Server

How can I prevent/balance waiting and turtling as a response to cooldown mechanics

What would you call this weird metallic apparatus that allows you to lift people?

Sally's older brother

Special flights

Flight departed from the gate 5 min before scheduled departure time. Refund options

Why not send Voyager 3 and 4 following up the paths taken by Voyager 1 and 2 to re-transmit signals of later as they fly away from Earth?

What initially awakened the Balrog?

Why complex landing gears are used instead of simple,reliability and light weight muscle wire or shape memory alloys?

How to ask rejected full-time candidates to apply to teach individual courses?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

Is multiple magic items in one inherently imbalanced?

Can an iPhone 7 be made to function as a NFC Tag?

Why weren't discrete x86 CPUs ever used in game hardware?

White walkers, cemeteries and wights

Mounting TV on a weird wall that has some material between the drywall and stud

Was Kant an Intuitionist about mathematical objects?

How to change the tick of the color bar legend to black

Can two people see the same photon?

How many time has Arya actually used Needle?

If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?



Multiline comments in Dockerfiles



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Docker updating image along when dockerfile changesUsing the RUN instruction in a Dockerfile with 'source' does not workWhat is the difference between CMD and ENTRYPOINT in a Dockerfile?Clone private git repo with dockerfileWhat is the difference between the `COPY` and `ADD` commands in a Dockerfile?How to write commands with multiple lines in Dockerfile while preserving the new lines?How do I make a comment in a Dockerfile?Multiple RUN vs. single chained RUN in Dockerfile, what is better?Creating bash script from Dockerfile strips commentsHow to specify working directory for ENTRYPOINT in Dockerfile



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








4















Is there a fast way to comment out multiple lines in a Dockerfile?



I know that I can add # at the beginning of each line. But if there are many lines this is too much work. In some languages there are multiline comments such as /* ... */, which makes commenting out large parts of a file very fast.










share|improve this question






















  • M-x comment-region will work in Emacs; .,.+4s/^/# / will comment out the next five lines in vi.

    – David Maze
    Mar 14 at 15:17











  • Any modern IDE will allow you to select lines with mouse and do a simple control + / to comment all of them

    – Pitto
    Mar 14 at 15:19











  • Some community editions of JetBrains' IDE do not recognize Dockerfiles. To still be able to use the control + / shortcut, create a new file type, set "Line comment" to "#" and associate your Dockerfile with the newly created file type.

    – user1460043
    Mar 21 at 10:29

















4















Is there a fast way to comment out multiple lines in a Dockerfile?



I know that I can add # at the beginning of each line. But if there are many lines this is too much work. In some languages there are multiline comments such as /* ... */, which makes commenting out large parts of a file very fast.










share|improve this question






















  • M-x comment-region will work in Emacs; .,.+4s/^/# / will comment out the next five lines in vi.

    – David Maze
    Mar 14 at 15:17











  • Any modern IDE will allow you to select lines with mouse and do a simple control + / to comment all of them

    – Pitto
    Mar 14 at 15:19











  • Some community editions of JetBrains' IDE do not recognize Dockerfiles. To still be able to use the control + / shortcut, create a new file type, set "Line comment" to "#" and associate your Dockerfile with the newly created file type.

    – user1460043
    Mar 21 at 10:29













4












4








4








Is there a fast way to comment out multiple lines in a Dockerfile?



I know that I can add # at the beginning of each line. But if there are many lines this is too much work. In some languages there are multiline comments such as /* ... */, which makes commenting out large parts of a file very fast.










share|improve this question














Is there a fast way to comment out multiple lines in a Dockerfile?



I know that I can add # at the beginning of each line. But if there are many lines this is too much work. In some languages there are multiline comments such as /* ... */, which makes commenting out large parts of a file very fast.







docker dockerfile






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 14 at 15:10









user1460043user1460043

945716




945716












  • M-x comment-region will work in Emacs; .,.+4s/^/# / will comment out the next five lines in vi.

    – David Maze
    Mar 14 at 15:17











  • Any modern IDE will allow you to select lines with mouse and do a simple control + / to comment all of them

    – Pitto
    Mar 14 at 15:19











  • Some community editions of JetBrains' IDE do not recognize Dockerfiles. To still be able to use the control + / shortcut, create a new file type, set "Line comment" to "#" and associate your Dockerfile with the newly created file type.

    – user1460043
    Mar 21 at 10:29

















  • M-x comment-region will work in Emacs; .,.+4s/^/# / will comment out the next five lines in vi.

    – David Maze
    Mar 14 at 15:17











  • Any modern IDE will allow you to select lines with mouse and do a simple control + / to comment all of them

    – Pitto
    Mar 14 at 15:19











  • Some community editions of JetBrains' IDE do not recognize Dockerfiles. To still be able to use the control + / shortcut, create a new file type, set "Line comment" to "#" and associate your Dockerfile with the newly created file type.

    – user1460043
    Mar 21 at 10:29
















M-x comment-region will work in Emacs; .,.+4s/^/# / will comment out the next five lines in vi.

– David Maze
Mar 14 at 15:17





M-x comment-region will work in Emacs; .,.+4s/^/# / will comment out the next five lines in vi.

– David Maze
Mar 14 at 15:17













Any modern IDE will allow you to select lines with mouse and do a simple control + / to comment all of them

– Pitto
Mar 14 at 15:19





Any modern IDE will allow you to select lines with mouse and do a simple control + / to comment all of them

– Pitto
Mar 14 at 15:19













Some community editions of JetBrains' IDE do not recognize Dockerfiles. To still be able to use the control + / shortcut, create a new file type, set "Line comment" to "#" and associate your Dockerfile with the newly created file type.

– user1460043
Mar 21 at 10:29





Some community editions of JetBrains' IDE do not recognize Dockerfiles. To still be able to use the control + / shortcut, create a new file type, set "Line comment" to "#" and associate your Dockerfile with the newly created file type.

– user1460043
Mar 21 at 10:29












2 Answers
2






active

oldest

votes


















1














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)






share|improve this answer






























    2














    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






    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55165989%2fmultiline-comments-in-dockerfiles%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      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)






      share|improve this answer



























        1














        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)






        share|improve this answer

























          1












          1








          1







          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)






          share|improve this answer













          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)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 14 at 15:27









          Pierre B.Pierre B.

          2,29011127




          2,29011127























              2














              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






              share|improve this answer





























                2














                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






                share|improve this answer



























                  2












                  2








                  2







                  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






                  share|improve this answer















                  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







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 22 at 11:56

























                  answered Mar 14 at 15:23









                  PittoPitto

                  1,93911726




                  1,93911726



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55165989%2fmultiline-comments-in-dockerfiles%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript