Documentation ¶
Index ¶
- func Attach(ctx context.Context, client *containerd.Client, req string, ...) error
- func Commit(ctx context.Context, client *containerd.Client, rawRef string, req string, ...) error
- func Cp(ctx context.Context, client *containerd.Client, ...) error
- func Create(ctx context.Context, client *containerd.Client, args []string, ...) (containerd.Container, func(), error)
- func Exec(ctx context.Context, client *containerd.Client, args []string, ...) error
- func GenerateLogURI(dataStore string) (*url.URL, error)
- func Inspect(ctx context.Context, client *containerd.Client, containers []string, ...) error
- func Kill(ctx context.Context, client *containerd.Client, reqs []string, ...) error
- func Logs(ctx context.Context, client *containerd.Client, container string, ...) error
- func NewStatusError(id string, status containerd.ProcessStatus) error
- func ParseDevice(s string) (hostDevPath string, mode string, err error)
- func Pause(ctx context.Context, client *containerd.Client, reqs []string, ...) error
- func Prune(ctx context.Context, client *containerd.Client, ...) error
- func Remove(ctx context.Context, client *containerd.Client, containers []string, ...) error
- func RemoveContainer(ctx context.Context, c containerd.Container, ...) (retErr error)
- func Rename(ctx context.Context, client *containerd.Client, ...) error
- func Restart(ctx context.Context, client *containerd.Client, containers []string, ...) error
- func Start(ctx context.Context, client *containerd.Client, reqs []string, ...) error
- func Stats(ctx context.Context, client *containerd.Client, containerIDs []string, ...) error
- func Stop(ctx context.Context, client *containerd.Client, reqs []string, ...) error
- func Top(ctx context.Context, client *containerd.Client, containers []string, ...) error
- func Unpause(ctx context.Context, client *containerd.Client, reqs []string, ...) error
- func UpdateContainerRestartPolicyLabel(ctx context.Context, client *containerd.Client, container containerd.Container, ...) error
- func Wait(ctx context.Context, client *containerd.Client, reqs []string, ...) error
- func WithSysctls(sysctls map[string]string) oci.SpecOpts
- func WithoutRunMount() ...
- type ContainerTopOKBody
- type ErrContainerStatus
- type GPUReq
- type ListItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attach ¶ added in v1.6.0
func Attach(ctx context.Context, client *containerd.Client, req string, options types.ContainerAttachOptions) error
Attach attaches stdin, stdout, and stderr to a running container.
func Commit ¶
func Commit(ctx context.Context, client *containerd.Client, rawRef string, req string, options types.ContainerCommitOptions) error
Commit will commit a container’s file changes or settings into a new image.
func Cp ¶ added in v1.2.1
func Cp(ctx context.Context, client *containerd.Client, options types.ContainerCpOptions) error
Cp copies files/folders between a running container and the local filesystem.
func Create ¶ added in v1.4.0
func Create(ctx context.Context, client *containerd.Client, args []string, netManager containerutil.NetworkOptionsManager, options types.ContainerCreateOptions) (containerd.Container, func(), error)
Create will create a container.
func Exec ¶
func Exec(ctx context.Context, client *containerd.Client, args []string, options types.ContainerExecOptions) error
Exec will find the right running container to run a new command.
func GenerateLogURI ¶ added in v1.4.0
GenerateLogURI generates a log URI for the current container store
func Inspect ¶
func Inspect(ctx context.Context, client *containerd.Client, containers []string, options types.ContainerInspectOptions) error
Inspect prints detailed information for each container in `containers`.
func Kill ¶
func Kill(ctx context.Context, client *containerd.Client, reqs []string, options types.ContainerKillOptions) error
Kill kills a list of containers
func Logs ¶
func Logs(ctx context.Context, client *containerd.Client, container string, options types.ContainerLogsOptions) error
func NewStatusError ¶
func NewStatusError(id string, status containerd.ProcessStatus) error
NewStatusError creates an ErrContainerStatus from container id and status.
func ParseDevice ¶ added in v1.4.0
ParseDevice parses the give device string into hostDevPath and mode(defaults: "rwm").
func Pause ¶
func Pause(ctx context.Context, client *containerd.Client, reqs []string, options types.ContainerPauseOptions) error
Pause pauses all containers specified by `reqs`.
func Prune ¶ added in v1.2.1
func Prune(ctx context.Context, client *containerd.Client, options types.ContainerPruneOptions) error
Prune remove all stopped containers
func Remove ¶
func Remove(ctx context.Context, client *containerd.Client, containers []string, options types.ContainerRemoveOptions) error
Remove removes a list of `containers`.
func RemoveContainer ¶
func RemoveContainer(ctx context.Context, c containerd.Container, globalOptions types.GlobalCommandOptions, force bool, removeAnonVolumes bool, client *containerd.Client) (retErr error)
RemoveContainer removes a container from containerd store.
func Rename ¶ added in v1.2.1
func Rename(ctx context.Context, client *containerd.Client, containerID, newContainerName string, options types.ContainerRenameOptions) error
Rename change container name to a new name containerID is container name, short ID, or long ID
func Restart ¶
func Restart(ctx context.Context, client *containerd.Client, containers []string, options types.ContainerRestartOptions) error
Restart will restart one or more containers.
func Start ¶
func Start(ctx context.Context, client *containerd.Client, reqs []string, options types.ContainerStartOptions) error
Start starts a list of `containers`. If attach is true, it only starts a single container.
func Stats ¶ added in v1.5.0
func Stats(ctx context.Context, client *containerd.Client, containerIDs []string, options types.ContainerStatsOptions) error
Stats displays a live stream of container(s) resource usage statistics.
func Stop ¶
func Stop(ctx context.Context, client *containerd.Client, reqs []string, opt types.ContainerStopOptions) error
Stop stops a list of containers specified by `reqs`.
func Top ¶
func Top(ctx context.Context, client *containerd.Client, containers []string, opt types.ContainerTopOptions) error
Top performs the equivalent of running `top` inside of container(s)
func Unpause ¶ added in v1.2.1
func Unpause(ctx context.Context, client *containerd.Client, reqs []string, options types.ContainerUnpauseOptions) error
Unpause unpauses all containers specified by `reqs`.
func UpdateContainerRestartPolicyLabel ¶ added in v1.4.0
func UpdateContainerRestartPolicyLabel(ctx context.Context, client *containerd.Client, container containerd.Container, restartFlag string) error
UpdateContainerRestartPolicyLabel updates the restart policy label of the container.
func Wait ¶ added in v1.2.1
func Wait(ctx context.Context, client *containerd.Client, reqs []string, options types.ContainerWaitOptions) error
Wait blocks until all the containers specified by reqs have stopped, then print their exit codes.
func WithSysctls ¶ added in v1.4.0
WithSysctls sets the provided sysctls onto the spec
Types ¶
type ContainerTopOKBody ¶
type ContainerTopOKBody struct { // Each process running in the container, where each is process // is an array of values corresponding to the titles. // // Required: true Processes [][]string `json:"Processes"` // The ps column titles // Required: true Titles []string `json:"Titles"` }
ContainerTopOKBody is from https://github.com/moby/moby/blob/v20.10.6/api/types/container/container_top.go
ContainerTopOKBody OK response to ContainerTop operation
type ErrContainerStatus ¶
type ErrContainerStatus struct { ID string Status containerd.ProcessStatus }
ErrContainerStatus represents an error that container is in a status unexpected by the caller. E.g., remove a non-stoped/non-created container without force.
func (ErrContainerStatus) Error ¶
func (e ErrContainerStatus) Error() string
type GPUReq ¶ added in v1.4.0
GPUReq is a request for GPUs.
func ParseGPUOptCSV ¶ added in v1.4.0
ParseGPUOptCSV parses a GPU option from CSV.
type ListItem ¶ added in v1.5.0
type ListItem struct { Command string CreatedAt time.Time ID string Image string Platform string // nerdctl extension Names string Ports string Status string Runtime string // nerdctl extension Size string Labels map[string]string }
func List ¶ added in v1.2.1
func List(ctx context.Context, client *containerd.Client, options types.ContainerListOptions) ([]ListItem, error)
List prints containers according to `options`.
Source Files ¶
- attach.go
- commit.go
- cp_linux.go
- create.go
- exec.go
- exec_linux.go
- inspect.go
- kill.go
- list.go
- list_util.go
- logs.go
- pause.go
- prune.go
- remove.go
- rename.go
- restart.go
- run_cgroup_linux.go
- run_gpus.go
- run_linux.go
- run_mount.go
- run_restart.go
- run_runtime.go
- run_security_linux.go
- run_ulimit.go
- run_user.go
- start.go
- stats.go
- stats_linux.go
- stop.go
- top.go
- top_unix.go
- unpause.go
- wait.go