moby: False positive "Empty continuation lines will become errors in a future release."
I have read https://github.com/moby/moby/issues/29005 but I don’t think this was implemented according to what was discussed there.
Description
I’m getting a false positive claiming “Empty continuation lines” however I have no lines which are empty and continued as far as I can tell. I do have a comment inside a command which was previously dropped during parsing but now emits a warning. Docker imo has better comment capabilities for long commands which are continued than the equivalent in bash
/ sh
which is one thing I’ll miss if this deprecation warning becomes an error.
Steps to reproduce the issue:
(this is a MCVE, my actual example is more involved and involves documenting a strange package in an apt line)
FROM ubuntu:xenial
RUN echo \
# descriptive comment
hello
docker build .
Describe the results you received:
$ docker build .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM ubuntu:xenial
---> 747cb2d60bbe
Step 2/2 : RUN echo hello
---> Running in 42350fdc3408
hello
---> 312472115b43
Removing intermediate container 42350fdc3408
[WARNING]: Empty continuation line found in:
RUN echo hello
[WARNING]: Empty continuation lines will become errors in a future release.
Describe the results you expected:
(no warning)
$ docker build .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM ubuntu:xenial
---> 747cb2d60bbe
Step 2/2 : RUN echo hello
---> Running in 42350fdc3408
hello
---> 312472115b43
Removing intermediate container 42350fdc3408
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version
:
$ docker version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:42:18 2017
OS/Arch: linux/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:56 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info
:
Containers: 8
Running: 0
Paused: 0
Stopped: 8
Images: 15
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.10.0-38-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 7.795GiB
Name: asottile-VirtualBox
ID: MCDD:BXAL:Y4PM:SIA7:I73R:W3F6:C4IY:ZEP4:K44W:XLYA:USI2:FAMT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Additional environment details (AWS, VirtualBox, physical, etc.):
I’m on virtualbox, though I doubt it matters
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (7 by maintainers)
Thanks for your examples; looking at those, that’s actually the intended behavior, because there are empty lines in the
RUN
;The correct approach for that would be to add a continuation marker (
\
) on the empty lines, for example;I attempted to describe why these empty lines can become problematic in https://github.com/moby/moby/issues/29005#issuecomment-264166814
Take this Dockerfile:
Building that Dockerfile will show the warning, but “install” foo and bar:
Now, just commenting the
install bar
line:And this will happen:
The
RUN echo "something else"
step is now seen as part of the previousRUN
@JoranDox I can see that being convenient for some cases; however, making that change would break thousands of existing Dockerfiles. Implementing https://github.com/moby/moby/issues/34423 would probably be a more convenient approach for that use-case.
@thaJeztah
Why not just treat an empty continuation line as the last line? this would avoid confusing diffs when changing this:
to
which would give an unnecessary change on the line for bar.
I’d much rather just have
so I can just delete (or even comment out) lines that are not needed on the fly:
(basically this: https://stackoverflow.com/questions/11597901/why-are-trailing-commas-allowed-in-a-list , but instead of python & comma, docker & backslash.)
@boywijnmaalen no worries; it tripped me as well a couple of times 😂