Skip to content

DL3048 accepting LABEL keys that contain underscore(s) or slash(es)#1034

Merged
m-ildefons merged 1 commit intohadolint:masterfrom
mschmeitz:patch-1
Aug 13, 2025
Merged

DL3048 accepting LABEL keys that contain underscore(s) or slash(es)#1034
m-ildefons merged 1 commit intohadolint:masterfrom
mschmeitz:patch-1

Conversation

@mschmeitz
Copy link
Copy Markdown

Underscores and slashes should be accepted as part of a LABEL key. See https://docs.docker.com/engine/manage-resources/labels/#key-format-recommendations

What I did

How I did it

How to verify it

@Bond-009
Copy link
Copy Markdown

Bond-009 commented Nov 5, 2024

From your own link (the guidelines following the main body):

Label keys should begin and end with a lower-case letter and should only contain lower-case alphanumeric characters, the period character (.), and the hyphen character (-). Consecutive periods or hyphens aren't allowed.

i.e. while underscores (_) and slashes (/) are technically allowed, you shouldn't use them

@mschmeitz
Copy link
Copy Markdown
Author

I agree, you should not use them. But it does not say, you may not use them. First sentence in the Docker Docs: https://docs.docker.com/engine/manage-resources/labels/#key-format-recommendations

A label key is the left-hand side of the key-value pair. Keys are alphanumeric strings which may contain periods (.), underscores (), slashes (/), and hyphens (-)._

So, either merge or decline.

@Bond-009
Copy link
Copy Markdown

Bond-009 commented Dec 8, 2024

First of all: this is a linter, the intention is helping to build best practice Docker images, not just valid ones.
You yourself agree underscores and slashes shouldn't be used in label keys.
Secondly I'm not a maintainer of this program, so I'm not in a position to accept or close this request. What I can do is give some context why the rule is the way it is and why this change doesn't make sense.

@m-ildefons m-ildefons merged commit fc81c22 into hadolint:master Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants