Documentation ¶
Index ¶
- func GuessBaseImageIndex(histories []v1.History) int
- func ID(img v1.Image) (string, error)
- func LayerIDs(img v1.Image) ([]string, error)
- func NewArchiveImage(fileName string) (types.Image, error)
- func NewContainerImage(ctx context.Context, imageName string, opt types.ImageOptions) (types.Image, func(), error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GuessBaseImageIndex ¶ added in v0.42.0
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.
- Iterate histories from the bottom.
- Skip all the empty layers at the bottom. In the above example, "entrypoint.sh" and "somecmd" will be skipped
- If it finds CMD, it assumes that it is the end of base layers.
- It gets all the layers as base layers above the CMD found in #3.
func NewContainerImage ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.