Skip to content

Extensions cannot reuse layers in the image registry #1505

@xujiyou

Description

@xujiyou

Summary

When installing CUDA via extensions and building two component images using pack build, the resulting images do not share the CUDA layer. This results in a lack of layer reuse and causes the image registry size to grow significantly.


Reproduction

Steps
  1. Add a CUDA installation step in the extensions phase (e.g., within an extender).
  2. Use pack build to build two separate component images with the same CUDA installation logic.
    such as:
pack build xxxx \
	--tag xxxx \
	-d .project.toml \
	--builder builder:1.0.04c2498df \
	--network host \
	--platform linux/amd64 \
	--creation-time now \
	--publish
  1. Push both images to the image registry.
Current behavior

Even though the CUDA installation is the same in both builds, the resulting images do not reuse the CUDA layer. Each image contains its own copy, increasing storage usage in the registry.

Expected behavior

The CUDA layer should be reused across images if the installation is identical, reducing image size and registry footprint.


Context

lifecycle version

Tested with lifecycle versions 0.20.7 and 0.20.10.

platform version(s)
# pack report
Pack:
  Version:  0.36.4+git-c7f5b1c.build-6274
  OS/Arch:  linux/amd64

Default Lifecycle Version:  0.20.3

Supported Platform APIs:  0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13

Config:
  experimental = true
  layout-repo-dir = "/root/.pack/layout-repo"
# docker info
Client:
 Version:    27.5.1
 Context:    default
 Debug Mode: false

Server:
 Containers: 16
  Running: 5
  Paused: 0
  Stopped: 11
 Images: 478
 Server Version: 27.5.1
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 4.14.0-115.el7a.0.1.aarch64
 Operating System: CentOS Linux 7 (AltArch)
 OSType: linux
 Architecture: aarch64
 CPUs: 128
 Total Memory: 510.6GiB
 Name: standalone-arm64-244-150
 ID: 7a38e7b1-3f07-4002-90be-2badd42a5bb7
 Docker Root Dir: /data1/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  registry.sensetime.com
  127.0.0.0/8
 Live Restore Enabled: true
 Product License: Community Engine

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions