2020-05-11 16:07:51 -07:00

28 lines
798 B
Go

package containerd
import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/oci"
)
func (d *Driver) isContainerdRunning() (bool, error) {
return d.client.IsServing(d.ctxContainerd)
}
func (d *Driver) getContainerdVersion() (containerd.Version, error) {
return d.client.Version(d.ctxContainerd)
}
func (d *Driver) pullImage(imageName string) (containerd.Image, error) {
return d.client.Pull(d.ctxContainerd, imageName, containerd.WithPullUnpack)
}
func (d *Driver) createContainer(image containerd.Image, containerName, containerSnapshotName string) (containerd.Container, error) {
return d.client.NewContainer(
d.ctxContainerd,
containerName,
containerd.WithNewSnapshot(containerSnapshotName, image),
containerd.WithNewSpec(oci.WithImageConfig(image)),
)
}