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

Preserve layer metadata of base image #280

Open
MoritzWeber0 opened this issue Jul 3, 2024 · 0 comments
Open

Preserve layer metadata of base image #280

MoritzWeber0 opened this issue Jul 3, 2024 · 0 comments

Comments

@MoritzWeber0
Copy link

When using the pack build command, the layer metadata of the run base image is not preserved and cleared out.

To reproduce, you can take the samples repository: https://github.com/buildpacks/samples

Let's run the following command as described in the "Build for ARM architecture" tutorial:

pack build java-maven-sample --path samples/apps/java-maven/ --builder heroku/builder:24 y

After the build, look at the history of the built image:

> docker history java-maven-sample

IMAGE          CREATED   CREATED BY                                      SIZE      COMMENT
7aaa72af6982   N/A       Buildpacks Process Types                        23B       
<missing>      N/A       Buildpacks Launcher Config                      488B      
<missing>      N/A       Buildpacks Application Launcher                 2.56MB    
<missing>      N/A       Application Layer                               18.6MB    
<missing>      N/A       Software Bill-of-Materials                      35.1kB    
<missing>      N/A       Layer: 'runtime', Created by buildpack: hero…   2.42MB    
<missing>      N/A       Layer: 'openjdk', Created by buildpack: hero…   223MB     
<missing>      N/A                                                       311MB     
<missing>      N/A                                                       101MB

As you can see, the last two layers (layers coming from the run base image) don't contain any "CREATED BY" or "COMMENT" information anymore.

It would be valuable to preserve the information in order to identify the commands used to build the layer during debugging.

The base image itself (heroku/heroku:24) contains the metadata information. The two relevant layers can be identified via the size (311MB and 101MB).

> docker history heroku/heroku

IMAGE          CREATED        CREATED BY                                      SIZE      COMMENT
a35bef8f087d   43 hours ago   LABEL io.buildpacks.stack.id=heroku-24          0B        buildkit.dockerfile.v0
<missing>      43 hours ago   LABEL io.buildpacks.base.maintainer=Heroku      0B        buildkit.dockerfile.v0
<missing>      43 hours ago   LABEL io.buildpacks.base.homepage=https://gi…   0B        buildkit.dockerfile.v0
<missing>      43 hours ago   LABEL io.buildpacks.base.distro.version=24.04   0B        buildkit.dockerfile.v0
<missing>      43 hours ago   LABEL io.buildpacks.base.distro.name=ubuntu     0B        buildkit.dockerfile.v0
<missing>      43 hours ago   USER heroku                                     0B        buildkit.dockerfile.v0
<missing>      43 hours ago   RUN /bin/sh -c /build/setup.sh # buildkit       311MB     buildkit.dockerfile.v0
<missing>      3 weeks ago    /bin/sh -c #(nop)  CMD ["/bin/bash"]            0B        
<missing>      3 weeks ago    /bin/sh -c #(nop) ADD file:9018302bda8cbdb55…   101MB     
<missing>      3 weeks ago    /bin/sh -c #(nop)  LABEL org.opencontainers.…   0B        
<missing>      3 weeks ago    /bin/sh -c #(nop)  LABEL org.opencontainers.…   0B        
<missing>      3 weeks ago    /bin/sh -c #(nop)  ARG LAUNCHPAD_BUILD_ARCH     0B        
<missing>      3 weeks ago    /bin/sh -c #(nop)  ARG RELEASE                  0B
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

1 participant