Code about task in "README.md" is out of date

Signed-off-by: SiYu Zhao <d.chaser.zsy@gmail.com>
This commit is contained in:
milkwine 2020-05-12 16:15:13 +08:00
parent 04985039ce
commit 9898dc2a64

View File

@ -154,7 +154,7 @@ Taking a container object and turning it into a runnable process on a system is
```go ```go
// create a new task // create a new task
task, err := redis.NewTask(context, cio.Stdio) task, err := redis.NewTask(context, cio.NewCreator(cio.WithStdio))
defer task.Delete(context) defer task.Delete(context)
// the task is now running and has a pid that can be use to setup networking // the task is now running and has a pid that can be use to setup networking
@ -184,7 +184,7 @@ checkpoint, err := client.Pull(context, "myregistry/checkpoints/redis:master")
redis, err = client.NewContainer(context, "redis-master", containerd.WithNewSnapshot("redis-rootfs", checkpoint)) redis, err = client.NewContainer(context, "redis-master", containerd.WithNewSnapshot("redis-rootfs", checkpoint))
defer container.Delete(context) defer container.Delete(context)
task, err = redis.NewTask(context, cio.Stdio, containerd.WithTaskCheckpoint(checkpoint)) task, err = redis.NewTask(context, cio.NewCreator(cio.WithStdio), containerd.WithTaskCheckpoint(checkpoint))
defer task.Delete(context) defer task.Delete(context)
err := task.Start(context) err := task.Start(context)