reverse

package
v0.0.0-...-5f60744 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadInstPrefix = errors.New("bad instruction prefix")
)

Functions

func SaveDockerfileData

func SaveDockerfileData(fatImageDockerfileLocation string, fatImageDockerfileLines []string) error

SaveDockerfileData saves the Dockerfile information to a file

Types

type Dockerfile

type Dockerfile struct {
	Lines                    []string             `json:"lines,omitempty"`
	Maintainers              []string             `json:"maintainers,omitempty"`
	AllUsers                 []string             `json:"all_users,omitempty"`
	ExeUser                  string               `json:"exe_user,omitempty"`
	ExposedPorts             []string             `json:"exposed_ports,omitempty"`
	ImageStack               []*ImageInfo         `json:"image_stack"`
	AllInstructions          []*InstructionInfo   `json:"all_instructions"`
	InstructionGroups        [][]*InstructionInfo `json:"instruction_groups"`
	InstructionGroupsReverse [][]*InstructionInfo `json:"instruction_groups_reverse"`
	HasOnbuild               bool                 `json:"has_onbuild"`
}

Dockerfile represents the reverse engineered Dockerfile info

func DockerfileFromHistory

func DockerfileFromHistory(apiClient *docker.Client, imageID string) (*Dockerfile, error)

DockerfileFromHistory recreates Dockerfile information from container image history

func DockerfileFromHistoryData

func DockerfileFromHistoryData(data string) (*Dockerfile, error)

DockerfileFromHistoryData recreates Dockerfile information from container image history

func DockerfileFromHistoryStruct

func DockerfileFromHistoryStruct(imageHistory []docker.ImageHistory) (*Dockerfile, error)

DockerfileFromHistoryStruct recreates Dockerfile information from container image history

type ImageInfo

type ImageInfo struct {
	IsTopImage   bool               `json:"is_top_image"`
	ID           string             `json:"id"`
	FullName     string             `json:"full_name"`
	RepoName     string             `json:"repo_name"`
	VersionTag   string             `json:"version_tag"`
	RawTags      []string           `json:"raw_tags,omitempty"`
	CreateTime   string             `json:"create_time"`
	NewSize      int64              `json:"new_size"`
	NewSizeHuman string             `json:"new_size_human"`
	BaseImageID  string             `json:"base_image_id,omitempty"`
	Instructions []*InstructionInfo `json:"instructions"`
}

type InstructionInfo

type InstructionInfo struct {
	Type string `json:"type"`
	Time string `json:"time"`
	//Time              time.Time `json:"time"`
	IsLastInstruction   bool     `json:"is_last_instruction,omitempty"`
	IsNop               bool     `json:"is_nop"`
	IsExecForm          bool     `json:"is_exec_form,omitempty"` //is exec/json format (a valid field for RUN, ENTRYPOINT, CMD)
	LocalImageExists    bool     `json:"local_image_exists"`
	IntermediateImageID string   `json:"intermediate_image_id,omitempty"`
	LayerIndex          int      `json:"layer_index"` //-1 for an empty layer
	LayerID             string   `json:"layer_id,omitempty"`
	LayerFSDiffID       string   `json:"layer_fsdiff_id,omitempty"`
	Size                int64    `json:"size"`
	SizeHuman           string   `json:"size_human,omitempty"`
	Params              string   `json:"params,omitempty"`
	CommandSnippet      string   `json:"command_snippet"`
	CommandAll          string   `json:"command_all"`
	SystemCommands      []string `json:"system_commands,omitempty"`
	Comment             string   `json:"comment,omitempty"`
	Author              string   `json:"author,omitempty"`
	EmptyLayer          bool     `json:"empty_layer,omitempty"`

	RawTags                 []string  `json:"raw_tags,omitempty"`
	Target                  string    `json:"target,omitempty"`      //for ADD and COPY
	SourceType              string    `json:"source_type,omitempty"` //for ADD and COPY
	IsBuildKitInstruction   bool      `json:"is_buildkit_instruction,omitempty"`
	BuildKitInfo            string    `json:"buildkit_info,omitempty"`
	TimeValue               time.Time `json:"-"`
	InstSetTimeBucket       time.Time `json:"inst_set_time_bucket,omitempty"`
	InstSetTimeIndex        int       `json:"inst_set_time_index"`
	InstSetTimeReverseIndex int       `json:"inst_set_time_reverse_index"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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