{"modulePath":"github.com/docker/CLI","version":"v29.10.1+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package container\n\n## Constants\n\n```go\nconst (\n\tPullImageAlways  = \"always\"\n\tPullImageMissing = \"missing\" // Default (matches previous behavior)\n\tPullImageNever   = \"never\"\n)\n```\nPull constants\n\n## Functions\n\n```go\nfunc ForwardAllSignals(ctx context.Context, apiClient client.ContainerAPIClient, cid string, sigc \u003c-chan os.Signal)\n```\nForwardAllSignals forwards signals to the container\n\nThe channel you pass in must already be setup to receive any signals you want to forward.\n\n```go\nfunc MonitorTtySize(ctx context.Context, cli command.Cli, id string, isExec bool) error\n```\nMonitorTtySize updates the container tty size when the terminal tty changes size\n\n```go\nfunc NewStatsFormat(source, osType string) formatter.Format\n```\nNewStatsFormat returns a format for rendering an CStatsContext\n\n```go\nfunc RunAttach(ctx context.Context, dockerCLI command.Cli, containerID string, opts *AttachOptions) error\n```\nRunAttach executes an \\`attach\\` command\n\n```go\nfunc RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName string, options ExecOptions) error\n```\nRunExec executes an \\`exec\\` command\n\n```go\nfunc RunStart(ctx context.Context, dockerCli command.Cli, opts *StartOptions) error\n```\nRunStart executes a \\`start\\` command\n\n```go\nfunc RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions) error\n```\nRunStats displays a live stream of resource usage statistics for one or more containers. This shows real-time information on CPU usage, memory usage, and network I/O.\n\n## Types\n\n```go\ntype AttachOptions struct {\n\tNoStdin    bool\n\tProxy      bool\n\tDetachKeys string\n}\n```\nAttachOptions group options for \\`attach\\` command\n\n```go\ntype ExecOptions struct {\n\tDetachKeys  string\n\tInteractive bool\n\tTTY         bool\n\tDetach      bool\n\tUser        string\n\tPrivileged  bool\n\tEnv         opts.ListOpts\n\tWorkdir     string\n\tCommand     []string\n\tEnvFile     opts.ListOpts\n}\n```\nExecOptions group options for \\`exec\\` command\n\n```go\nfunc NewExecOptions() ExecOptions\n```\nNewExecOptions creates a new ExecOptions\n\n```go\ntype StartOptions struct {\n\tAttach        bool\n\tOpenStdin     bool\n\tDetachKeys    string\n\tCheckpoint    string\n\tCheckpointDir string\n\n\tContainers []string\n}\n```\nStartOptions group options for \\`start\\` command\n\n```go\ntype Stats struct {\n\tStatsEntry\n\t// contains filtered or unexported fields\n}\n```\nStats represents an entity to store containers statistics synchronously\n\n```go\nfunc NewStats(idOrName string) *Stats\n```\nNewStats returns a new Stats entity using the given ID, ID-prefix, or name to resolve the container.\n\n```go\nfunc (cs *Stats) GetError() error\n```\nGetError returns the container statistics error. This is used to determine whether the statistics are valid or not\n\n```go\nfunc (cs *Stats) GetStatistics() StatsEntry\n```\nGetStatistics returns container statistics with other meta data such as the container name\n\n```go\nfunc (cs *Stats) SetError(err error)\n```\nSetError sets container statistics error\n\n```go\nfunc (cs *Stats) SetErrorAndReset(err error)\n```\nSetErrorAndReset zeroes all the container statistics and store the error. It is used when receiving time out error during statistics collecting to reduce lock overhead\n\n```go\nfunc (cs *Stats) SetStatistics(s StatsEntry)\n```\nSetStatistics set the container statistics\n\n```go\ntype StatsEntry struct {\n\tContainer        string\n\tName             string\n\tID               string\n\tCPUPercentage    float64\n\tMemory           float64 // On Windows this is the private working set\n\tMemoryLimit      float64 // Not used on Windows\n\tMemoryPercentage float64 // Not used on Windows\n\tNetworkRx        float64\n\tNetworkTx        float64\n\tBlockRead        float64\n\tBlockWrite       float64\n\tPidsCurrent      uint64 // Not used on Windows\n\tIsInvalid        bool\n}\n```\nStatsEntry represents the statistics data collected from a container\n\n```go\ntype StatsOptions struct {\n\t// All allows including both running and stopped containers. The default\n\t// is to only include running containers.\n\tAll bool\n\n\t// NoStream disables streaming stats. If enabled, stats are collected once,\n\t// and the result is printed.\n\tNoStream bool\n\n\t// NoTrunc disables truncating the output. The default is to truncate\n\t// output such as container-IDs.\n\tNoTrunc bool\n\n\t// Format is a custom template to use for presenting the stats.\n\t// Refer to [flagsHelper.FormatHelp] for accepted formats.\n\tFormat string\n\n\t// Containers is the list of container names or IDs to include in the stats.\n\t// If empty, all containers are included. It is mutually exclusive with the\n\t// Filters option, and an error is produced if both are set.\n\tContainers []string\n\n\t// Filters provides optional filters to filter the list of containers and their\n\t// associated container-events to include in the stats if no list of containers\n\t// is set. If no filter is provided, all containers are included. Filters and\n\t// Containers are currently mutually exclusive, and setting both options\n\t// produces an error.\n\t//\n\t// These filters are used both to collect the initial list of containers and\n\t// to refresh the list of containers based on container-events, accepted\n\t// filters are limited to the intersection of filters accepted by \"events\"\n\t// and \"container list\".\n\t//\n\t// Currently only \"label\" / \"label=value\" filters are accepted. Additional\n\t// filter options may be added in future (within the constraints described\n\t// above), but may require daemon-side validation as the list of accepted\n\t// filters can differ between daemon- and API versions.\n\tFilters client.Filters\n}\n```\nStatsOptions defines options for [RunStats](#RunStats).\n\n","path":"github.com/docker/CLI/cli/command/container","name":"container","synopsis":"","isRedistributable":true}
