containerd/cmd/dist/apply.go
Derek McGowan 6443891a7d Update log lines to use containerd log package
Removed unused requires root test function and updated
tar requires function to use lookup method.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-17 11:50:49 -08:00

37 lines
722 B
Go

package main
import (
contextpkg "context"
"os"
"github.com/docker/containerd/archive"
"github.com/docker/containerd/log"
dockerarchive "github.com/docker/docker/pkg/archive"
"github.com/urfave/cli"
)
var applyCommand = cli.Command{
Name: "apply",
Usage: "apply layer from stdin to dir",
ArgsUsage: "[flags] <digest>",
Flags: []cli.Flag{},
Action: func(context *cli.Context) error {
var (
ctx = contextpkg.Background()
dir = context.Args().First()
)
log.G(ctx).Info("applying layer from stdin")
rd, err := dockerarchive.DecompressStream(os.Stdin)
if err != nil {
return err
}
if _, err := archive.Apply(ctx, dir, rd); err != nil {
return err
}
return nil
},
}