image

package
v3.9.0-2856 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GuessBaseImageIndex

func GuessBaseImageIndex(histories []v1.History) int

GuessBaseImageIndex tries to guess index of base layer

e.g. In the following example, we should detect layers in debian:8.

FROM debian:8
RUN apt-get update
COPY mysecret /
ENTRYPOINT ["entrypoint.sh"]
CMD ["somecmd"]

debian:8 may be like

ADD file:5d673d25da3a14ce1f6cf66e4c7fd4f4b85a3759a9d93efb3fd9ff852b5b56e4 in /
CMD ["/bin/sh"]

In total, it would be like:

ADD file:5d673d25da3a14ce1f6cf66e4c7fd4f4b85a3759a9d93efb3fd9ff852b5b56e4 in /
CMD ["/bin/sh"]              # empty layer (detected)
RUN apt-get update
COPY mysecret /
ENTRYPOINT ["entrypoint.sh"] # empty layer (skipped)
CMD ["somecmd"]              # empty layer (skipped)

This method tries to detect CMD in the second line and assume the first line is a base layer.

  1. Iterate histories from the bottom.
  2. Skip all the empty layers at the bottom. In the above example, "entrypoint.sh" and "somecmd" will be skipped
  3. If it finds CMD, it assumes that it is the end of base layers.
  4. It gets all the layers as base layers above the CMD found in #3.

func ID

func ID(img v1.Image) (string, error)

func LayerIDs

func LayerIDs(img v1.Image) ([]string, error)

func NewArchiveImage

func NewArchiveImage(fileName string) (types.Image, error)

func NewContainerImage

func NewContainerImage(ctx context.Context, imageName string, opt types.ImageOptions) (types.Image, func(), error)

Types

This section is empty.

Directories

Path Synopsis
ecr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL