Merge pull request #1939 from schomatis/update-getting-started-stdio

Update getting-started guide with the new IO implementation
This commit is contained in:
Phil Estes 2017-12-21 12:58:44 -05:00 committed by GitHub
commit 634a0e8008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,7 @@ A task is a live, running process on the system.
Tasks should be deleted after each run while a container can be used, updated, and queried multiple times. Tasks should be deleted after each run while a container can be used, updated, and queried multiple times.
```go ```go
task, err := container.NewTask(ctx, cio.Stdio) task, err := container.NewTask(ctx, cio.NewCreator(cio.WithStdio))
if err != nil { if err != nil {
return err return err
} }
@ -239,7 +239,9 @@ Tasks should be deleted after each run while a container can be used, updated, a
``` ```
The new task that we just created is actually a running process on your system. The new task that we just created is actually a running process on your system.
We use the `cio.Stdio` `Opt` so that all IO from the container is sent to our `main.go` process. We use `cio.WithStdio` so that all IO from the container is sent to our `main.go` process.
This is a `cio.Opt` that configures the `Streams` used by `NewCreator` to return a `cio.IO`
for the new task.
If you are familiar with the OCI runtime actions, the task is currently in the "created" state. If you are familiar with the OCI runtime actions, the task is currently in the "created" state.
This means that the namespaces, root filesystem, and various container level settings have been initialized but the user defined process, in this example "redis-server", has not been started. This means that the namespaces, root filesystem, and various container level settings have been initialized but the user defined process, in this example "redis-server", has not been started.
@ -360,7 +362,7 @@ func redisExample() error {
defer container.Delete(ctx, containerd.WithSnapshotCleanup) defer container.Delete(ctx, containerd.WithSnapshotCleanup)
// create a task from the container // create a task from the container
task, err := container.NewTask(ctx, cio.Stdio) task, err := container.NewTask(ctx, cio.NewCreator(cio.WithStdio))
if err != nil { if err != nil {
return err return err
} }