docker

package
v2.23.6 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutocompleteRun

func AutocompleteRun(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

func EnsureStopContainer

func EnsureStopContainer(ctx context.Context, name, containerID string, volumes []string, exited, signalled *atomic.Bool, done chan<- error)

func ReadContainerID

func ReadContainerID(ctx context.Context, cidFile string) (containerID string, err error)

ReadContainerID reads the containerID that docker run --cidfile <cidfils> writes to a file, and then removes the file. It returns fs.ErrNotExist if no such file has been produced within 200 ms.

Types

type Flags

type Flags struct {
	Run          bool     // --docker-run
	Debug        bool     // set if --docker-debug was used
	BuildOptions []string // --docker-build-opt key=value, // Optional flag to docker build can be repeated (but not comma separated)
	Context      string   // Set to build or debug by Validate function
	Image        string
	Mount        string // --docker-mount // where to mount in a docker container. Defaults to mount unless mount is "true" or "false".
	// contains filtered or unexported fields
}

func (*Flags) AddFlags

func (f *Flags) AddFlags(flagSet *pflag.FlagSet, what string)

func (*Flags) AdjustImageIndex added in v2.23.0

func (f *Flags) AdjustImageIndex(adjust int)

func (*Flags) GetContainerNameAndArgs

func (f *Flags) GetContainerNameAndArgs(defaultContainerName string) (string, []string, error)

func (*Flags) PullOrBuildImage

func (f *Flags) PullOrBuildImage(ctx context.Context) error

PullOrBuildImage will pull or build the image and return the args list suitable when starting it.

func (*Flags) Validate

func (f *Flags) Validate(args []string) error

type Mount added in v2.22.0

type Mount struct {
	Type    string
	Source  string
	Target  string
	Options string
}

func (*Mount) String added in v2.22.0

func (m *Mount) String() string

type Network added in v2.23.0

type Network struct {
	Name    string
	Aliases []string
}

type PublishedPort

type PublishedPort struct {
	HostAddrPort  netip.AddrPort
	Protocol      string
	ContainerPort uint16
}

func (PublishedPort) String

func (c PublishedPort) String() string

type PublishedPorts

type PublishedPorts []PublishedPort

func (*PublishedPorts) Append

func (p *PublishedPorts) Append(s string) error

func (*PublishedPorts) GetSlice

func (p *PublishedPorts) GetSlice() []string

func (*PublishedPorts) Replace

func (p *PublishedPorts) Replace(vals []string) error

func (*PublishedPorts) Set

func (p *PublishedPorts) Set(s string) error

func (*PublishedPorts) String

func (p *PublishedPorts) String() string

func (*PublishedPorts) Type

func (p *PublishedPorts) Type() string

type RunFlags

type RunFlags struct {
	Name    string
	Volumes []Volume
	Mounts  []Mount
}

func ParseRunFlags

func ParseRunFlags(args []string) (*RunFlags, []string, error)

type Runner

type Runner struct {
	Flags
	ContainerName string
	Environment   map[string]string
	Mount         *mount.Info
	// contains filtered or unexported fields
}

func (*Runner) Run

func (s *Runner) Run(ctx context.Context, waitMessage string, args ...string) error

type Volume added in v2.22.0

type Volume struct {
	Name    string
	Target  string
	Options string
}

func (*Volume) String added in v2.22.0

func (v *Volume) String() string

Jump to

Keyboard shortcuts

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