Updates for containerd alpha0

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2017-07-12 23:15:12 -07:00
parent 764adcf998
commit 9e9df712ec
3 changed files with 23 additions and 10 deletions

View File

@ -46,7 +46,7 @@ func NewContainerd(root, address string) (*Controller, error) {
func newContainerdPullDeps(client *containerd.Client) *pullDeps { func newContainerdPullDeps(client *containerd.Client) *pullDeps {
diff := client.DiffService() diff := client.DiffService()
return &pullDeps{ return &pullDeps{
Snapshotter: client.SnapshotService(), Snapshotter: client.SnapshotService(""),
ContentStore: client.ContentStore(), ContentStore: client.ContentStore(),
Applier: diff, Applier: diff,
Differ: diff, Differ: diff,

View File

@ -9,6 +9,7 @@ import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/rootfs" "github.com/containerd/containerd/rootfs"
@ -214,14 +215,26 @@ func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableR
mfstDone(nil) mfstDone(nil)
if e.opt.Images != nil && e.targetName != "" { if e.opt.Images != nil && e.targetName != "" {
tagDone := oneOffProgress(ctx, "tagging to "+e.targetName) tagDone := oneOffProgress(ctx, "naming to "+e.targetName)
err := e.opt.Images.Update(ctx, e.targetName, ocispec.Descriptor{ imgrec := images.Image{
Digest: dgst, Name: e.targetName,
Size: int64(len(dt)), Target: ocispec.Descriptor{
MediaType: ocispec.MediaTypeImageManifest, Digest: dgst,
}) Size: int64(len(dt)),
MediaType: ocispec.MediaTypeImageManifest,
},
CreatedAt: time.Now(),
}
_, err := e.opt.Images.Update(ctx, imgrec)
if err != nil { if err != nil {
return tagDone(err) if !errdefs.IsNotFound(err) {
return tagDone(err)
}
_, err := e.opt.Images.Create(ctx, imgrec)
if err != nil {
return tagDone(err)
}
} }
tagDone(nil) tagDone(nil)
} }

View File

@ -241,7 +241,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store) {
actives := make(map[string]statusInfo) actives := make(map[string]statusInfo)
if !done { if !done {
active, err := cs.Status(ctx, "") active, err := cs.ListStatuses(ctx, "")
if err != nil { if err != nil {
// log.G(ctx).WithError(err).Error("active check failed") // log.G(ctx).WithError(err).Error("active check failed")
continue continue
@ -290,7 +290,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store) {
Action: "done", Action: "done",
Current: int(info.Size), Current: int(info.Size),
Total: int(info.Size), Total: int(info.Size),
Completed: &info.CommittedAt, Completed: &info.CreatedAt,
Started: &j.started, Started: &j.started,
}) })
} }