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

Copy Annotations into config.json (Docker Labels) #692

Closed
amouat opened this issue May 22, 2023 · 5 comments · Fixed by #727
Closed

Copy Annotations into config.json (Docker Labels) #692

amouat opened this issue May 22, 2023 · 5 comments · Fixed by #727

Comments

@amouat
Copy link
Contributor

amouat commented May 22, 2023

Apko currently supports adding annotations as per the OCI Image spec: https://github.com/opencontainers/image-spec/blob/main/annotations.md

Docker's support for annotations seems a bit mixed, and in particular docker inspect will not display annotations. For this reason, it might be worth adding annotations into the config, which will get surfaced in docker inspect and easily found/searched/scripted etc.

@mritunjaysharma394
Copy link
Contributor

mritunjaysharma394 commented May 23, 2023

Hi @amouat, I am not sure if I understood what we meant by config here, is it : ~/.docker/config.json ( a guess because of the title of the issue but I don't think we will make the change here so it may be something else) or this https://github.com/google/go-containerregistry/blob/main/pkg/v1/image.go (feels more like this) or the config.json that couples with rootfs as a bundle to be finally run by runc at the lower levels?

So if we try to understand you suggested adding the Annotations field in a modified version of v1/image.go specific for our use case of allowing them to be visible in docker inspect?

@mritunjaysharma394
Copy link
Contributor

mritunjaysharma394 commented May 23, 2023

Oh okay I think I got it, you probably meant this right which becomes the eventual config.json + rootfs bundle? So how do we plan to copy it here, by creating a new field for annotations right?

@amouat
Copy link
Contributor Author

amouat commented May 23, 2023

More or less @mritunjaysharma394. I'm talking about this file to be exact, which is in every image tarball.

My suggestion is not to add anything new to the apko yaml, but when building the image add annotations both in the manifest and as Labels in the config.json. Then they will appear in docker inspect which basically displays and parses the config.json.

@mritunjaysharma394
Copy link
Contributor

mritunjaysharma394 commented May 23, 2023

Oh that makes sense, thanks a bunch @amouat, I think so that more or less I have understood the assignment here:

  • update Labels which are a map so annotations can be hopefully easily added here.
  • we already have Annotations in Manifest struct so that should be handleable too to add the annotations?

If that sounds okay, maybe I can try to get my hands dirty and create a proposal/PR/Draft PR to implement this? Thanks again 🙏

@amouat
Copy link
Contributor Author

amouat commented May 23, 2023

That would be great @mritunjaysharma394! However, I would like @kaniini or someone to verify that we do want this functionality first.

Assuming we do, it's hopefully just a case of copying the annotations struct into the labels struct for the config.

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 a pull request may close this issue.

3 participants