MCPcopy Index your code
hub / github.com/containerd/containerd / Exec

Method Exec

internal/cri/server/container_exec.go:28–40  ·  view source on GitHub ↗

Exec prepares a streaming endpoint to execute a command in the container, and returns the address.

(ctx context.Context, r *runtime.ExecRequest)

Source from the content-addressed store, hash-verified

26
27// Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
28func (c *criService) Exec(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error) {
29 span := tracing.SpanFromContext(ctx)
30 cntr, err := c.containerStore.Get(r.GetContainerId())
31 if err != nil {
32 return nil, fmt.Errorf("failed to find container %q in store: %w", r.GetContainerId(), err)
33 }
34 span.SetAttributes(tracing.Attribute("container.id", cntr.ID))
35 state := cntr.Status.Get().State()
36 if state != runtime.ContainerState_CONTAINER_RUNNING {
37 return nil, fmt.Errorf("container is in %s state", criContainerStateToString(state))
38 }
39 return c.streamServer.GetExec(r)
40}

Callers

nothing calls this directly

Implementers 1

criServiceinternal/cri/server/service.go

Calls 6

SpanFromContextFunction · 0.92
AttributeFunction · 0.92
SetAttributesMethod · 0.80
GetMethod · 0.65
StateMethod · 0.65

Tested by

no test coverage detected