moby / moby

The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
https://mobyproject.org/
Apache License 2.0
68.66k stars 18.64k forks source link

bug: comment on preceding line in Dockerfile causes subsequent run comments to be ignored #24693

Open Dieterbe opened 8 years ago

Dieterbe commented 8 years ago

maybe a the same as moby/buildkit#4240, though the issue there doesn't seem as severe.

Output of docker version:

docker version
Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.6.2
 Git commit:   b9f10c9
 Built:        Tue Jun 21 00:43:14 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.6.2
 Git commit:   b9f10c9
 Built:        Tue Jun 21 00:43:14 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 11
 Running: 0
 Paused: 0
 Stopped: 11
Images: 254
Server Version: 1.11.2
Storage Driver: devicemapper
 Pool Name: docker-254:0-5513598-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: ext4
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 17.35 GB
 Data Space Total: 107.4 GB
 Data Space Available: 69.74 GB
 Metadata Space Used: 20.98 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.127 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.127 (2016-06-17)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: null host bridge
Kernel Version: 4.5.4-1-ARCH
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.33 GiB
Name: dieter-m6800
ID: AMPP:4IZ5:BFKQ:LZVT:IAGF:OCS6:4BMI:RI4W:4EZY:6TK3:ZZJV:CBBX
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/

The problem is, with the below dockerfile - as the run output below that shows - the line with RUN go get github.com/tsenart/vegeta gets parsed as if its part of the previous command, and gets prepended with #, so the command is not run.

what is expected: run RUN go get github.com/tsenart/vegeta as its own run command.

FROM raintank/nodejsgo

ENV GOPATH /go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin

RUN apt-get -y install wget vim bc supervisor
RUN mkdir -p /go/src/github.com/grafana
RUN cd /go/src/github.com/grafana && \
    git clone https://github.com/raintank/grafana-api-golang-client.git && \
    cd grafana-api-golang-client && \
    git checkout raintank #&& \
    #go get github.com/raintank/env-load

RUN go get github.com/tsenart/vegeta
RUN go get github.com/raintank/inspect/inspect-es

CMD ["/usr/bin/supervisord"]
docker build .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM raintank/nodejsgo
 ---> b7aacd1c2f48
Step 2 : ENV GOPATH /go
 ---> Using cache
 ---> 420832244d3e
Step 3 : ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
 ---> Using cache
 ---> 7c875ee90ed4
Step 4 : RUN apt-get -y install wget vim bc supervisor
 ---> Using cache
 ---> 18e36c697f9a
Step 5 : RUN mkdir -p /go/src/github.com/grafana
 ---> Using cache
 ---> c339b442715c
Step 6 : RUN cd /go/src/github.com/grafana &&   git clone https://github.com/raintank/grafana-api-golang-client.git &&      cd grafana-api-golang-client &&     git checkout raintank #&& RUN go get github.com/tsenart/vegeta
 ---> Using cache
 ---> 2ef4a1c65071
Step 7 : RUN go get github.com/raintank/inspect/inspect-es
 ---> Using cache
 ---> 9d10cd05695c
Step 8 : CMD /usr/bin/supervisord
 ---> Running in 68942f5f7bb9
 ---> 1a8760d6fae8
Removing intermediate container 68942f5f7bb9
Successfully built 1a8760d6fae8
yongtang commented 8 years ago

@Dieterbe The issue is that the empty line following the escape is not recognized as the break. I created a pull request moby/moby#24725 to try to address this issue. Please let me know if it helps or there are any issues.

thaJeztah commented 7 years ago

Unfortunately, we had to revert the fix for this, because it was too much of a breaking change, see https://github.com/docker/docker/issues/29005. I'll reopen this issue