Skip to content

Using LABEL in multi-stage builds #22940

Open
@dreua

Description

@dreua

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

I can't find what I'm looking for

Description

I came upon this multi-stage Dockerfile which declares LABELs in the build stage and then continues to copy the binary to a new scratch image. From my inspection and rebuilds with podman that is a bug as the labels only appear in the resulting image after I moved the statements to the bottom of the file. Therefore my question which the current documentation does not answer:

Are LABEL statements context specific, i.e. only applied to the current building context and not to the images created by subsequent FROM statements? (It looks to me like they are.)

Location

https://docs.docker.com/reference/dockerfile/

Suggestion

If my assumption is correct that should be made clearer in the specification, maybe give some guidance on where or where not to put the LABEL statements in order to avoid mistakes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions