docker

package
v2.21.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const Exe = "docker"

Variables

This section is empty.

Functions

func AutocompleteRun

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

func ConnectNetworksToDaemon

func ConnectNetworksToDaemon(ctx context.Context, networks []string, daemonName string) (context.CancelFunc, error)

func EnsureStopContainer

func EnsureStopContainer(ctx context.Context, containerID string, volumes []string, exited, signalled *atomic.Bool)

func ReadContainerID

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

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)
	PublishedPorts PublishedPorts // --publish Port mappings that the container will expose on localhost
	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) 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 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 {
	PublishedPorts PublishedPorts // --publish Port mappings that the container will expose on localhost
	Networks       []string
}

func ParseRunFlags

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

type Runner

type Runner struct {
	Flags
	ContainerName string
	Environment   map[string]string
	Mount         *mount.Info
}

func (*Runner) Run

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

Jump to

Keyboard shortcuts

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