func (c *container) Spec(ctx context.Context) (*specs.Spec, error) {
	r, err := c.get(ctx)
	if err != nil {
		return nil, err
	}
	var s specs.Spec
	if err := json.Unmarshal(r.Spec.Value, &s); err != nil {
		return nil, err
	}
	return &s, nil
}
Spec returns the current OCI specification for the container
package containerd
import (
	"context"
	"encoding/json"
	"path/filepath"
	"strings"
	"github.com/containerd/containerd/api/services/tasks/v1"
	"github.com/containerd/containerd/api/types"
	"github.com/containerd/containerd/cio"
	"github.com/containerd/containerd/containers"
	"github.com/containerd/containerd/errdefs"
	"github.com/containerd/typeurl"
	prototypes "github.com/gogo/protobuf/types"
	specs "github.com/opencontainers/runtime-spec/specs-go"
	"github.com/pkg/errors"
)
type Container interface {
	ID() string
	Info(context.Context) (containers.Container, error)
	Delete(context.Context, ...DeleteOpts) error
	NewTask(context.Context, cio.Creation, ...NewTaskOpts) (Task, error)
	Spec(context.Context) (*specs.Spec, error)
	Task(context.Context, cio.Attach) (Task, error)
	Image(context.Context) (Image, error)
	Labels(context.Context) (map[string]string, error)
	SetLabels(context.Context, map[string]string) (map[string]string, error)
	Extensions(context.Context) (map[string]prototypes.Any, error)
	Update(context.Context, ...UpdateContainerOpts) error
}
func containerFromRecord(client *Client, c containers.Container) *container {
	return &container{
		client: client,
		id:     c.ID,
	}
}
var _ = (Container)(&container{})
type container struct {
	client *Client
	id     string
}
func (c *container) ID() string {
	return c.id
}
func (c *container) Info(ctx context.Context) (containers.Container, error) {
	return c.get(ctx)
}
func (c *container) Extensions(ctx context.Context) (map[string]prototypes.Any, error) {
	r, err := c.get(ctx)
	if err != nil {
		return nil, err
	}
	return r.Extensions, nil
}
func (c *container) Labels(ctx context.Context) (map[string]string, error) {
	r, err := c.get(ctx)
	if err != nil {
		return nil, err
	}
	return r.Labels, nil
}
func (c *container) SetLabels(ctx context.Context, labels map[string]string) (map[string]string, error) {
	container := containers.Container{
		ID:     c.id,
		Labels: labels,
	}
	var paths []string
	for k := range labels {
		paths = append(paths, strings.Join([]string{"labels", k}, "."))
	}
	r, err := c.client.ContainerService().Update(ctx, container, paths...)
	if err != nil {
		return nil, err
	}
	return r.Labels, nil
}