Proposal: Allow specification of LABEL Name/Value pairs in image json content#8955
Proposal: Allow specification of LABEL Name/Value pairs in image json content#8955rhatdan wants to merge 1 commit intomoby:masterfrom
Conversation
rhatdan
commented
Nov 4, 2014
|
This pull request replaces the Meta pull |
|
To give you an idea of what kind of data we would see being stored in META data fields. Look at what rpm ships Name : httpd |
|
Adding more JSON to the dockerfile seems like a mistake, as we're looking to deprecate that. Perhaps you'd like the syntax in #8251 instead? I would greatly prefer using that. |
|
This is not about putting data into the container, it is about adding data to help Vendors describe their images. Think of the images as being applications. Vendors want to describe their applications based on things like licenses, versions, Short and long description, build dates, build servers ... This data should be included in the json data related to the image, and should be flexible, since it is impossible to describe all potential fields a vendor would like to have. |
|
We don’t want JSON in the Dockerfile. It’s already polluted and complicated a number of issues as is, and we’re looking to deprecate the existing syntax. Look strongly at the ENV pull request mentioned in my previous comment, and see if the parser it uses can be leveraged for your purposes.
|
|
I think it's also more readable from a user standpoint in the env variable syntax, also +1 for no more json |
|
json allows for embedded key value pairs whereas the ENV pull referenced is limiting to a flat key value set. |
|
@jfrazelle @erikh So you would like the syntax to be USERDATA Description="This is a tool for reading docker images" Version=1.0 License=GPL |
|
Yes.
|
|
Changed the proposal to use Name/Value Pairs rather then JSON. |
|
thanks! :) |
|
Hi there, From my point of view, starting points about userdata are:
Here are some of the datas that I would like to keep in the Dockerfile :
By the way, there also some specific datas that may be usefull to formalize : the recommanded way to use start the container :
All of these could be used in the registry to improve and standardize the images information. External tools could also instrumentalize the way to start containers (maybe like github.com/yesnault/docktor try to do). |
|
I do like the idea of setting “preferences” but I think this is out of scope for this PR. Please feel free to submit a proposal if you have strong feelings about where this should go in the future.
|
Are newlines supported with this notation? Because this becomes very un-readable if a lot of key/value pairs have to be set. To illustrate, this would be the line for the properties in the PR description; Additionally, with this notation;
Not debating the env-style notation, just trying to get the practical implications, because I foresee that the USERDATA can contain quite lot of data. |
|
I expect to be able to support this syntax. The name value pairs will get wrapped in Quotes (") if they do not contain them and then converted internally to json format. A null string will end up being "". |
|
This sounds great to me.
|
|
@rhatdan this line: |
|
Multiline could be supported by: I also expect Unfortunately this proposal touches quoting issues (like #8251). Should we first accept quoting for USERDATA and ENV, and then eventually bring it to other instructions? Or should we bring quoting as a whole to the Dockerfile, and therefore quoting issues can be left out from this proposal? |
|
I would like to restrict it to userdata and env for now, seeing as there are optional backwards-compat methods of dealing with this in both places.
|
The problem I see there, is that we're probable running out of layers very quickly. So, if possible, being able to define multiple key/value pairs per
that example is to use new lines inside a value; would it be possible somehow to (eg) define one key/value pair per line (without creating new layers)? |
|
|
I think it should support whatever we add to ENV except for the space separation. I think that should be deprecated. I think it confuses the usability rather then enhances it. I would like to see repeated Or USERDATA lines combined into a single layer. Maybe only have layers for commands that add lots of content like ADD and RUN. |
|
@jlhawn is the layer problem being worked on by someone, or do you think we should start squashing things like |
There was a problem hiding this comment.
Can you move this to the v1.17 section
ccbb533 to
8f0b391
Compare
runconfig/config.go
Outdated
There was a problem hiding this comment.
I feel Labels would be more consistent with other fields such as ExposedPorts and Volumes. I know env is not plural, but I think thats just because "envs" is weird.
1211af0 to
698693c
Compare
There was a problem hiding this comment.
Typo, should be { ... } not [ ... ]
f625f59 to
0fa2834
Compare
Save "LABEL" field in Dockerfile into image content. This will allow a user to save user data into an image, which can later be retrieved using: docker inspect IMAGEID I have copied this from the "Comment" handling in docker images. We want to be able to add Name/Value data to an image to describe the image, and then be able to use other tools to look at this data, to be able to do security checks based on this data. We are thinking about adding version names, Perhaps listing the content of the dockerfile. Descriptions of where the code came from etc. This LABEL field should also be allowed to be specified in the docker import --change LABEL:Name=Value docker commit --change LABEL:Name=Value Docker-DCO-1.1-Signed-off-by: Dan Walsh <[email protected]> (github: rhatdan)
|
@icecrime yes. |