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

Question: Can we extract/unpack the new layers added to an image except the parent ? #399

Open
cmoulliard opened this issue Oct 29, 2021 · 3 comments

Comments

@cmoulliard
Copy link

Question: Can we extract/unpack the new layers added to an image except the parent ?

Why such a question ? For the buildpacks CNCF project we are investigating a way to extend the following application - Lifecycle in order during a build to perform the following steps:

  • Execute a Dockerfiles top of an image to add new packages, ... (see: https://github.com/redhat-buildpacks/poc/blob/main/bud/bud.go#L40). A new image is created locally and is available under the graph folder path (vfs, overlay, ...)
  • Find the newly created layers (without the parent)
  • Extract the content of the new layers created to a volume mounted (e.g /extracted)
  • The content extracted will be next used by the lifecycle application to build an image for a runtime (Java spring boot, quarkus). As some needed tools are not packaged with the builder image, they will then become available from the /extracted volume mounted

Use umoci as lib

As we plan to use umoci from the lifecycle application, I'm wondering if it could be reused as a go lib module ?

@cyphar
Copy link
Member

cyphar commented Nov 2, 2021

This is not really doable with the umoci CLI at the moment, but (to answer your second question) you can use umoci as a library (https://github.com/cisco/stacker uses it for instance) and as a library you could call the individual layer extraction functions for each layer yourself.

Though it should be noted that umoci's library APIs are still technically unstable until 1.0 (though in practice I try not to make breaking changes, and any such changes are mentioned in the changelog).

@cmoulliard
Copy link
Author

This is not really doable with the umoci CLI at the moment, but (to answer your second question) you can use umoci as a library (https://github.com/cisco/stacker uses it for instance) and as a library you could call the individual layer extraction functions for each layer yourself.

Many thanks for the information. I will have a look. BTW, the github project (cisco/stacker) reported is not publicly available

@cyphar
Copy link
Member

cyphar commented Nov 8, 2021

My bad, it's not in the cisco organisation. https://github.com/anuvu/stacker is the right repo.

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

No branches or pull requests

2 participants