-
Notifications
You must be signed in to change notification settings - Fork 137
Description
Expected behavior
One of:
- Documentation that mentions the explicit max length for labels (65518 bytes) and exit non zero if a Label exceeds the max length
- Remove the arbitrary max length entirely.
Actual behavior
If a label in a dockerfile exceeds 65518 bytes in length, docker build will report having built successfully but will silently fail to handle the label or any further lines in the dockerfile.
I suspect this issue lives somewhere in the line parser of the dockerfile. It is concerning to me that my CI is "successfully" building docker images that may be missing half their expected content.
It seems plausible that whatever parsing issue is happening on labels may also be affecting other commands, though I haven't tested that.
This repros on both OSX and linux.
Note: If generating the image config json directly, without the use of docker build there is no length limit to a label (at least, I haven't found one).
Information
Diagnostic ID: 5C4BCB4B-3581-4B4E-8D90-0F50337CC32C
Docker for Mac: version: 17.09.0-ce-mac35 (69202b202f497d4b6e627c3370781b9e4b51ec78)
macOS: version 10.12.6 (build: 16G29)
logs: /tmp/5C4BCB4B-3581-4B4E-8D90-0F50337CC32C/20171107-164723.tar.gz
[OK] db.git
[OK] vmnetd
[OK] dns
[OK] driver.amd64-linux
[OK] virtualization VT-X
[OK] app
[OK] moby
[OK] system
[OK] moby-syslog
[OK] db
[OK] env
[OK] virtualization kern.hv_support
[OK] slirp
[OK] osxfs
[OK] moby-console
[OK] logs
[OK] docker-cli
[OK] menubar
[OK] disk
Steps to reproduce the behavior
A dockerfile containing the following:
FROM docker-registry.REDACTED.com/jvm-deps:1e985c2bf99c3ed80af928bd6b71ae10ec9f4b69
RUN mkdir -p /data/app/noop-app/libs
COPY libs_list.txt /data/app/noop-app/libs_list.txt
LABEL test="label of length less than 65519 bytes"
COPY noop_libs.txt /data/app/noop-app/noop_libs.txt
If the length of the label is 65518 bytes or less, the output of docker build reads:
Step 1/5 : FROM docker-registry.REDACTED.com/jvm-deps:1e985c2bf99c3ed80af928bd6b71ae10ec9f4b69
---> ffd557d5a452
Step 2/5 : RUN mkdir -p /data/app/noop-app/libs
---> Using cache
---> 72cbbaa69bee
Step 3/5 : COPY libs_list.txt /data/app/noop-app/libs_list.txt
---> Using cache
---> 5ac7fae0cf0a
Step 4/5 : LABEL test "label of length less than 65519 bytes"
---> Using cache
---> 48e4b9a8edb1
Step 5/5 : COPY noop_libs.txt /data/app/noop-app/noop_libs.txt
---> 0f58eb87fb61
Removing intermediate container 035415978ba8
Successfully built 0f58eb87fb61
If we replace the label in the above dockerfile with a string 65519 bytes or longer (I used "a" * 65519) the output of docker build reads:
Step 1/5 : FROM docker-registry.REDACTED.com/jvm-deps:1e985c2bf99c3ed80af928bd6b71ae10ec9f4b69
---> ffd557d5a452
Step 2/3 : RUN mkdir -p /data/app/noop-app/libs
---> Using cache
---> 72cbbaa69bee
Step 3/3 : COPY libs_list.txt /data/app/noop-app/libs_list.txt
---> Using cache
---> 5ac7fae0cf0a
Successfully built 5ac7fae0cf0a