Documentation
¶
Index ¶
- Variables
- type BuildOptions
- type Inspector
- func (i *Inspector) FormatImageSize(size int64) string
- func (i *Inspector) GetAllTags(ctx context.Context, imageID string) ([]string, error)
- func (i *Inspector) GetImageCommand(ctx context.Context, imageIDOrName string) ([]string, error)
- func (i *Inspector) GetImageCreationTime(ctx context.Context, imageIDOrName string) (time.Time, error)
- func (i *Inspector) GetImageDigest(ctx context.Context, imageIDOrName string) (string, error)
- func (i *Inspector) GetImageEntrypoint(ctx context.Context, imageIDOrName string) ([]string, error)
- func (i *Inspector) GetImageEnvironment(ctx context.Context, imageIDOrName string) ([]string, error)
- func (i *Inspector) GetImageExposedPorts(ctx context.Context, imageIDOrName string) (map[string]struct{}, error)
- func (i *Inspector) GetImageLabels(ctx context.Context, imageIDOrName string) (map[string]string, error)
- func (i *Inspector) GetImageLayers(ctx context.Context, imageIDOrName string) ([]string, error)
- func (i *Inspector) GetImageOSArch(ctx context.Context, imageIDOrName string) (string, string, error)
- func (i *Inspector) GetImageSize(ctx context.Context, imageIDOrName string) (int64, error)
- func (i *Inspector) GetTotalImageDiskUsage(ctx context.Context) (int64, error)
- func (i *Inspector) GetTotalImagesCount(ctx context.Context) (int, error)
- func (i *Inspector) History(ctx context.Context, imageIDOrName string) ([]imagetypes.HistoryResponseItem, error)
- func (i *Inspector) ImageExists(ctx context.Context, imageIDOrName string) (bool, error)
- func (i *Inspector) Inspect(ctx context.Context, imageIDOrName string) (types.ImageInspect, error)
- func (i *Inspector) List(ctx context.Context, options ListOptions) ([]imagetypes.Summary, error)
- type InspectorClient
- type ListOptions
- type PruneOptions
- type PullOptions
- type RemoveOptions
- type SearchOptions
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( ErrImageNotFound = errors.New("image not found") ErrImageInspection = errors.New("failed to inspect image") ErrImageListing = errors.New("failed to list images") ErrImageHistory = errors.New("failed to get image history") ErrInvalidImageID = errors.New("invalid image ID or reference") ErrContextCancelled = errors.New("operation cancelled") )
Common errors
Functions ¶
This section is empty.
Types ¶
type BuildOptions ¶
type BuildOptions struct {
Context io.Reader
ContextDir string
Dockerfile string
Tags []string
BuildArgs map[string]*string
NoCache bool
Remove bool
ForceRemove bool
PullParent bool
ProgressOutput io.Writer
BuildLabels map[string]string
Target string
Platform string
RegistryAuth string
}
BuildOptions defines options for building images
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
Inspector provides methods for inspecting Docker images
func NewInspector ¶
func NewInspector(client InspectorClient, logger *logrus.Logger) *Inspector
NewInspector creates a new image inspector
func (*Inspector) FormatImageSize ¶
FormatImageSize formats the image size in a human-readable format
func (*Inspector) GetAllTags ¶
GetAllTags returns all tags for an image
func (*Inspector) GetImageCommand ¶
GetImageCommand returns the default command of an image
func (*Inspector) GetImageCreationTime ¶
func (i *Inspector) GetImageCreationTime(ctx context.Context, imageIDOrName string) (time.Time, error)
GetImageCreationTime returns the creation time of an image
func (*Inspector) GetImageDigest ¶
GetImageDigest extracts the digest from an image
func (*Inspector) GetImageEntrypoint ¶
GetImageEntrypoint returns the entrypoint of an image
func (*Inspector) GetImageEnvironment ¶
func (i *Inspector) GetImageEnvironment(ctx context.Context, imageIDOrName string) ([]string, error)
GetImageEnvironment returns the environment variables of an image
func (*Inspector) GetImageExposedPorts ¶
func (i *Inspector) GetImageExposedPorts(ctx context.Context, imageIDOrName string) (map[string]struct{}, error)
GetImageExposedPorts returns the exposed ports of an image as map[string]struct{}
func (*Inspector) GetImageLabels ¶
func (i *Inspector) GetImageLabels(ctx context.Context, imageIDOrName string) (map[string]string, error)
GetImageLabels returns the labels of an image
func (*Inspector) GetImageLayers ¶
GetImageLayers returns the layers of an image
func (*Inspector) GetImageOSArch ¶
func (i *Inspector) GetImageOSArch(ctx context.Context, imageIDOrName string) (string, string, error)
GetImageOSArch returns the OS and architecture of an image
func (*Inspector) GetImageSize ¶
GetImageSize returns the size of an image in bytes
func (*Inspector) GetTotalImageDiskUsage ¶
GetTotalImageDiskUsage returns the total disk space used by all images
func (*Inspector) GetTotalImagesCount ¶
GetTotalImagesCount returns the total number of images
func (*Inspector) History ¶
func (i *Inspector) History(ctx context.Context, imageIDOrName string) ([]imagetypes.HistoryResponseItem, error)
History returns the history of a Docker image
func (*Inspector) ImageExists ¶
ImageExists checks if an image exists
func (*Inspector) List ¶
func (i *Inspector) List(ctx context.Context, options ListOptions) ([]imagetypes.Summary, error)
List returns a list of Docker images based on the provided options
type InspectorClient ¶
type InspectorClient interface {
ImageList(ctx context.Context, options imagetypes.ListOptions) ([]imagetypes.Summary, error)
ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)
ImageHistory(ctx context.Context, imageID string, options ...client.ImageHistoryOption) ([]imagetypes.HistoryResponseItem, error) // Added options parameter
}
InspectorClient defines the interface for Docker client methods used by the image inspector.
type ListOptions ¶
type ListOptions struct {
All bool
FilterLabels map[string]string
FilterDanglingOnly bool
MatchName string
FilterBefore string
FilterSince string
FilterReference string
}
ListOptions defines options for listing images
type PruneOptions ¶
PruneOptions defines options for pruning images
type PullOptions ¶
type PullOptions struct {
All bool
Platform string
RegistryAuth string
ProgressOutput io.Writer
Quiet bool
}
PullOptions defines options for pulling images
type RemoveOptions ¶
RemoveOptions defines options for removing images
type SearchOptions ¶
SearchOptions defines options for searching images
type Service ¶
type Service interface {
ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error)
ImageInspectWithRaw(ctx context.Context, imageID string) (image.InspectResponse, []byte, error) // Use direct type
ImageRemove(ctx context.Context, imageID string, options image.RemoveOptions) ([]image.DeleteResponse, error) // Use direct type
List(ctx context.Context, options ListOptions) ([]imagetypes.Summary, error) // Use imagetypes.Summary
Build(ctx context.Context, options BuildOptions) (io.ReadCloser, error)
Tag(ctx context.Context, imageID, ref string) error
Inspect(ctx context.Context, imageID string) (imagetypes.InspectResponse, error) // Use types.ImageInspect
History(ctx context.Context, imageID string) ([]imagetypes.HistoryResponseItem, error) // Use imagetypes.HistoryResponseItem
Prune(ctx context.Context, options PruneOptions) (imagetypes.PruneReport, error) // Use imagetypes.PruneReport
Search(ctx context.Context, term string, options SearchOptions) ([]registrytypes.SearchResult, error) // Use registrytypes.SearchResult
}
Service defines the interface for Docker image operations Aligned with interfaces.ImageService