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

LABELs split across mutliple lines in Dockerfile are handled incorrectly #1149

Closed
miabbott opened this issue Jul 24, 2018 · 2 comments
Closed
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@miabbott
Copy link
Contributor

/kind bug

When building an image from a Dockerfile that has key=value pairs split across multiple lines of a single LABEL instruction, the resulting image has a mangled LABEL output.

This was observed on Fedora 28, using podman 0.7.2:

$ cat Dockerfile.multi 
FROM registry.fedoraproject.org/fedora:28
LABEL io.openshift.commit = "deadbeef" \
      io.openshift.version = "3.11"
ENTRYPOINT "/bin/bash"

$ sudo podman build -t quay.io/miabbott/podman-label-test:multi -f Dockerfile.multi
STEP 1: FROM registry.fedoraproject.org/fedora:28
STEP 2: LABEL io.openshift.commit = "deadbeef"       io.openshift.version = "3.11"
STEP 3: ENTRYPOINT "/bin/bash"
STEP 4: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.override_kernel_check=true]quay.io/miabbott/podman-label-test:multi
Getting image source signatures
Skipping fetch of repeat blob sha256:4656e146fab7f95ad90808bab5aa27e0041f1fa2427597a68efc6fa66693689d
Skipping fetch of repeat blob sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
Copying config sha256:2a84c16f3f8d0cead85069105deb6399e6d0d27a657b730d90e8e2abb8c71fa1
 733 B / 733 B [============================================================] 0s
Writing manifest to image destination
Storing signatures
--> 2a84c16f3f8d0cead85069105deb6399e6d0d27a657b730d90e8e2abb8c71fa1

$ sudo podman inspect quay.io/miabbott/podman-label-test:multi
[
    {
        "Id": "2a84c16f3f8d0cead85069105deb6399e6d0d27a657b730d90e8e2abb8c71fa1",
        "Digest": "sha256:d1c1fdaf1387d124cfdca4bd38b759c72177e2d72847c7f552b2bd7d383ddd5a",
        "RepoTags": [
            "quay.io/miabbott/podman-label-test:multi"
        ],
        "RepoDigests": [
            "quay.io/miabbott/podman-label-test@sha256:d1c1fdaf1387d124cfdca4bd38b759c72177e2d72847c7f552b2bd7d383ddd5a"                                                                                          
        ],
        "Parent": "",
        "Comment": "Created by Image Factory",
        "Created": "2018-07-24T14:12:44.280970058Z",
        "ContainerConfig": {
            "Env": [
                "DISTTAG=f28container",
                "FGC=f28",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Entrypoint": [
                "/bin/sh",
                "-c",
                "\"/bin/bash\""
            ],
            "WorkingDir": "/",
            "Labels": {
                "io.openshift.commit": "= deadbeef       io.openshift.version = 3.11",
                "license": "MIT",
                "name": "fedora",
                "vendor": "Fedora Project",
                "version": "28"
            }
        },
        "Version": "",
        "Author": "",
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 262873295,
        "VirtualSize": 262873295,
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/var/lib/containers/storage/overlay/4656e146fab7f95ad90808bab5aa27e0041f1fa2427597a68efc6fa66693689d/diff",
                "MergedDir": "/var/lib/containers/storage/overlay/091bcce0127a47ee3e4342cbc6fe065b2a7f0787718ce7dab7e755031df09902/merged",
                "UpperDir": "/var/lib/containers/storage/overlay/091bcce0127a47ee3e4342cbc6fe065b2a7f0787718ce7dab7e755031df09902/diff",
                "WorkDir": "/var/lib/containers/storage/overlay/091bcce0127a47ee3e4342cbc6fe065b2a7f0787718ce7dab7e755031df09902/work"
            }
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:4656e146fab7f95ad90808bab5aa27e0041f1fa2427597a68efc6fa66693689d",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
            ]
        },
        "Labels": {
            "io.openshift.commit": "= deadbeef       io.openshift.version = 3.11",
            "license": "MIT",
            "name": "fedora",
            "vendor": "Fedora Project",
            "version": "28"
        },
        "Annotations": {},
        "ManifestType": "application/vnd.oci.image.manifest.v1+json",
        "User": ""
    }
]

If I change the Dockerfile to use a single LABEL instruction per key=value pair, it works correctly:

$ cat Dockerfile.single 
FROM registry.fedoraproject.org/fedora:28
LABEL io.openshift.commit = "deadbeef"
LABEL io.openshift.version = "3.11"
ENTRYPOINT "/bin/bash"

$ sudo podman build -t quay.io/miabbott/podman-label-test:single -f Dockerfile.single
STEP 1: FROM registry.fedoraproject.org/fedora:28
STEP 2: LABEL io.openshift.commit = "deadbeef"
STEP 3: LABEL io.openshift.version = "3.11"
STEP 4: ENTRYPOINT "/bin/bash"
STEP 5: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.override_kernel_check=true]quay.io/miabbott/podman-label-test:single
Getting image source signatures
Skipping fetch of repeat blob sha256:4656e146fab7f95ad90808bab5aa27e0041f1fa2427597a68efc6fa66693689d
Skipping fetch of repeat blob sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
Copying config sha256:b05f036107d096578f7ced852104d3a9506079f77cbc3c03cbcbc9b88d4d8f27
 729 B / 729 B [============================================================] 0s
Writing manifest to image destination
Storing signatures
--> b05f036107d096578f7ced852104d3a9506079f77cbc3c03cbcbc9b88d4d8f27

$ sudo podman inspect quay.io/miabbott/podman-label-test:single
[                  
    {
        "Id": "b05f036107d096578f7ced852104d3a9506079f77cbc3c03cbcbc9b88d4d8f27",
        "Digest": "sha256:bd815b2a4be9cf8157844cf28eb86b8757c3c533fff8a2134bcd2bb0296dafde",
        "RepoTags": [
            "quay.io/miabbott/podman-label-test:single"
        ],
        "RepoDigests": [
            "quay.io/miabbott/podman-label-test@sha256:bd815b2a4be9cf8157844cf28eb86b8757c3c533fff8a2134bcd2bb0296dafde"
        ],
        "Parent": "",
        "Comment": "Created by Image Factory",
        "Created": "2018-07-24T14:14:20.42654769Z",
        "ContainerConfig": {
            "Env": [
                "DISTTAG=f28container",
                "FGC=f28",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Entrypoint": [
                "/bin/sh",
                "-c",
                "\"/bin/bash\""
            ],
            "WorkingDir": "/",
            "Labels": {
                "io.openshift.commit": "= deadbeef",
                "io.openshift.version": "= 3.11",
                "license": "MIT",
                "name": "fedora",
                "vendor": "Fedora Project",
                "version": "28"
            }
        },
        "Version": "",
        "Author": "",
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 262873291,
        "VirtualSize": 262873291,
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/var/lib/containers/storage/overlay/4656e146fab7f95ad90808bab5aa27e0041f1fa2427597a68efc6fa66693689d/diff",
                "MergedDir": "/var/lib/containers/storage/overlay/091bcce0127a47ee3e4342cbc6fe065b2a7f0787718ce7dab7e755031df09902/merged",
                "UpperDir": "/var/lib/containers/storage/overlay/091bcce0127a47ee3e4342cbc6fe065b2a7f0787718ce7dab7e755031df09902/diff",
                "WorkDir": "/var/lib/containers/storage/overlay/091bcce0127a47ee3e4342cbc6fe065b2a7f0787718ce7dab7e755031df09902/work"
            }
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:4656e146fab7f95ad90808bab5aa27e0041f1fa2427597a68efc6fa66693689d",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
            ]
        },
        "Labels": {
            "io.openshift.commit": "= deadbeef",
            "io.openshift.version": "= 3.11",
            "license": "MIT",
            "name": "fedora",
            "vendor": "Fedora Project",
            "version": "28"
        },
        "Annotations": {},
        "ManifestType": "application/vnd.oci.image.manifest.v1+json",
        "User": ""
    }
]
@mheon
Copy link
Member

mheon commented Jul 24, 2018

This looks like a Buildah bug, as we use Buildah for builds.
@miabbott Can you refile against https://github.com/projectatomic/buildah

@miabbott
Copy link
Contributor Author

Ah, that makes sense. Moving over there - containers/buildah#879.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

2 participants