container

package
v23.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PullImageAlways  = "always"
	PullImageMissing = "missing" // Default (matches previous behavior)
	PullImageNever   = "never"
)

Pull constants

Variables

This section is empty.

Functions

func DiffFormatWrite

func DiffFormatWrite(ctx formatter.Context, changes []container.ContainerChangeResponseItem) error

DiffFormatWrite writes formatted diff using the Context

func ForwardAllSignals

func ForwardAllSignals(ctx context.Context, cli command.Cli, cid string, sigc <-chan os.Signal)

ForwardAllSignals forwards signals to the container

The channel you pass in must already be setup to receive any signals you want to forward.

func MonitorTtySize

func MonitorTtySize(ctx context.Context, cli command.Cli, id string, isExec bool) error

MonitorTtySize updates the container tty size when the terminal tty changes size

func NewAttachCommand

func NewAttachCommand(dockerCli command.Cli) *cobra.Command

NewAttachCommand creates a new cobra.Command for `docker attach`

func NewCommitCommand

func NewCommitCommand(dockerCli command.Cli) *cobra.Command

NewCommitCommand creates a new cobra.Command for `docker commit`

func NewContainerCommand

func NewContainerCommand(dockerCli command.Cli) *cobra.Command

NewContainerCommand returns a cobra command for `container` subcommands

func NewCopyCommand

func NewCopyCommand(dockerCli command.Cli) *cobra.Command

NewCopyCommand creates a new `docker cp` command

func NewCreateCommand

func NewCreateCommand(dockerCli command.Cli) *cobra.Command

NewCreateCommand creates a new cobra.Command for `docker create`

func NewDiffCommand

func NewDiffCommand(dockerCli command.Cli) *cobra.Command

NewDiffCommand creates a new cobra.Command for `docker diff`

func NewDiffFormat

func NewDiffFormat(source string) formatter.Format

NewDiffFormat returns a format for use with a diff Context

func NewExecCommand

func NewExecCommand(dockerCli command.Cli) *cobra.Command

NewExecCommand creates a new cobra.Command for `docker exec`

func NewExportCommand

func NewExportCommand(dockerCli command.Cli) *cobra.Command

NewExportCommand creates a new `docker export` command

func NewKillCommand

func NewKillCommand(dockerCli command.Cli) *cobra.Command

NewKillCommand creates a new cobra.Command for `docker kill`

func NewLogsCommand

func NewLogsCommand(dockerCli command.Cli) *cobra.Command

NewLogsCommand creates a new cobra.Command for `docker logs`

func NewPauseCommand

func NewPauseCommand(dockerCli command.Cli) *cobra.Command

NewPauseCommand creates a new cobra.Command for `docker pause`

func NewPortCommand

func NewPortCommand(dockerCli command.Cli) *cobra.Command

NewPortCommand creates a new cobra.Command for `docker port`

func NewPruneCommand

func NewPruneCommand(dockerCli command.Cli) *cobra.Command

NewPruneCommand returns a new cobra prune command for containers

func NewPsCommand

func NewPsCommand(dockerCli command.Cli) *cobra.Command

NewPsCommand creates a new cobra.Command for `docker ps`

func NewRenameCommand

func NewRenameCommand(dockerCli command.Cli) *cobra.Command

NewRenameCommand creates a new cobra.Command for `docker rename`

func NewRestartCommand

func NewRestartCommand(dockerCli command.Cli) *cobra.Command

NewRestartCommand creates a new cobra.Command for `docker restart`

func NewRmCommand

func NewRmCommand(dockerCli command.Cli) *cobra.Command

NewRmCommand creates a new cobra.Command for `docker rm`

func NewRunCommand

func NewRunCommand(dockerCli command.Cli) *cobra.Command

NewRunCommand create a new `docker run` command

func NewStartCommand

func NewStartCommand(dockerCli command.Cli) *cobra.Command

NewStartCommand creates a new cobra.Command for `docker start`

func NewStatsCommand

func NewStatsCommand(dockerCli command.Cli) *cobra.Command

NewStatsCommand creates a new cobra.Command for `docker stats`

func NewStatsFormat

func NewStatsFormat(source, osType string) formatter.Format

NewStatsFormat returns a format for rendering an CStatsContext

func NewStopCommand

func NewStopCommand(dockerCli command.Cli) *cobra.Command

NewStopCommand creates a new cobra.Command for `docker stop`

func NewTopCommand

func NewTopCommand(dockerCli command.Cli) *cobra.Command

NewTopCommand creates a new cobra.Command for `docker top`

func NewUnpauseCommand

func NewUnpauseCommand(dockerCli command.Cli) *cobra.Command

NewUnpauseCommand creates a new cobra.Command for `docker unpause`

func NewUpdateCommand

func NewUpdateCommand(dockerCli command.Cli) *cobra.Command

NewUpdateCommand creates a new cobra.Command for `docker update`

func NewWaitCommand

func NewWaitCommand(dockerCli command.Cli) *cobra.Command

NewWaitCommand creates a new cobra.Command for `docker wait`

func RunExec

func RunExec(dockerCli command.Cli, options ExecOptions) error

RunExec executes an `exec` command

func RunPrune

func RunPrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error)

RunPrune calls the Container Prune API This returns the amount of space reclaimed and a detailed output string

func RunStart

func RunStart(dockerCli command.Cli, opts *StartOptions) error

RunStart executes a `start` command

Types

type ExecOptions

type ExecOptions struct {
	DetachKeys  string
	Interactive bool
	TTY         bool
	Detach      bool
	User        string
	Privileged  bool
	Env         opts.ListOpts
	Workdir     string
	Container   string
	Command     []string
	EnvFile     opts.ListOpts
}

ExecOptions group options for `exec` command

func NewExecOptions

func NewExecOptions() ExecOptions

NewExecOptions creates a new ExecOptions

type StartOptions

type StartOptions struct {
	Attach        bool
	OpenStdin     bool
	DetachKeys    string
	Checkpoint    string
	CheckpointDir string

	Containers []string
}

StartOptions group options for `start` command

func NewStartOptions

func NewStartOptions() StartOptions

NewStartOptions creates a new StartOptions

type Stats

type Stats struct {
	StatsEntry
	// contains filtered or unexported fields
}

Stats represents an entity to store containers statistics synchronously

func NewStats

func NewStats(container string) *Stats

NewStats returns a new Stats entity and sets in it the given name

func (*Stats) GetError

func (cs *Stats) GetError() error

GetError returns the container statistics error. This is used to determine whether the statistics are valid or not

func (*Stats) GetStatistics

func (cs *Stats) GetStatistics() StatsEntry

GetStatistics returns container statistics with other meta data such as the container name

func (*Stats) SetError

func (cs *Stats) SetError(err error)

SetError sets container statistics error

func (*Stats) SetErrorAndReset

func (cs *Stats) SetErrorAndReset(err error)

SetErrorAndReset zeroes all the container statistics and store the error. It is used when receiving time out error during statistics collecting to reduce lock overhead

func (*Stats) SetStatistics

func (cs *Stats) SetStatistics(s StatsEntry)

SetStatistics set the container statistics

type StatsEntry

type StatsEntry struct {
	Container        string
	Name             string
	ID               string
	CPUPercentage    float64
	Memory           float64 // On Windows this is the private working set
	MemoryLimit      float64 // Not used on Windows
	MemoryPercentage float64 // Not used on Windows
	NetworkRx        float64
	NetworkTx        float64
	BlockRead        float64
	BlockWrite       float64
	PidsCurrent      uint64 // Not used on Windows
	IsInvalid        bool
}

StatsEntry represents represents the statistics data collected from a container

Jump to

Keyboard shortcuts

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