Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile comment line with continuation #3898

Closed
SvenDowideit opened this issue Feb 3, 2014 · 5 comments · Fixed by #4759
Closed

Dockerfile comment line with continuation #3898

SvenDowideit opened this issue Feb 3, 2014 · 5 comments · Fixed by #4759

Comments

@SvenDowideit
Copy link
Contributor

I just commented out one line of a RUN command with a set of 's on the end (and when that errored out, moved the commented out line to just before the RUN

and the line continuation thus commented out the entire set :)

so I went from

RUN something && \
         else && \
         else && \
         else && \
         last

to

RUN something && \
#         else && \
         else && \
         else && \
         last

which quietly works ? to

#         else && \
RUN something && \
         else && \
         else && \
         last

and therefore the RUN was completely commented out.

We can either define this as 'works as intended' and so I'll document it, or decide that its a little too surprising (given that its a very hidden omission) and thus process the # before the \

@shykes @crosbymichael opinions?

@florentx
Copy link

florentx commented Feb 9, 2014

I hit this one repeatedly :-/

crosbymichael added a commit to crosbymichael/docker that referenced this issue Mar 27, 2014
Fixes moby#3898
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
@leandro-lucarella-sociomantic

Hi, I will comment on this one even when is really old because I'm getting some deprecation message about this syntax.

I basically have this:

LABEL \
    maintainer="Me" \
    # Some comment about the next line
    description="Some image"

And I get this (docker-ce 17.09.0):

[WARNING]: Empty continuation line found in:
    LABEL     maintainer="Me"     description="Some image"
[WARNING]: Empty continuation lines will become errors in a future release.

I search for information about how line continuation and comments should be handled and couldn't find anything relevant except for this issue. I tried adding a \ and the end of the comment and is the same.

Given that is recommended everywhere to use line continuations with ENV and LABEL to avoid creating loads of layers (this is just an example, I have images with plenty of labels), it seems weird to have no clear solution to put comments in these multi-line commands.

Should I create a new issue about this?

@robertjpayne
Copy link

@leandro-lucarella-sociomantic same here, unsure if this is a regression or not?

@thaJeztah
Copy link
Member

@leandro-lucarella-sociomantic @robertjpayne see #35004

@leandro-lucarella-sociomantic

Ah, nice! Do you know if this will be part of a patch release or we'll have to wait until next full release to stop getting the deprecation messages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants