Change WithSpec to take SpecOpts
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@ For many functions and methods within the client package you will generally see
|
||||
|
||||
If we look at the `NewContainer` method on the client we can see that it has a required argument of `id` and then additional `NewContainerOpts`.
|
||||
|
||||
There are a few built in options that allow the container to be created with an existing spec, `WithNewSpec`, and snapshot opts for creating or using an existing snapshot.
|
||||
There are a few built in options that allow the container to be created with an existing spec, `WithSpec`, and snapshot opts for creating or using an existing snapshot.
|
||||
|
||||
```go
|
||||
func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) {
|
||||
@@ -90,9 +90,8 @@ Adding your new option to spec generation is as easy as importing your new packa
|
||||
```go
|
||||
import "github.com/crosbymichael/monitor"
|
||||
|
||||
spec, err := containerd.GenerateSpec(
|
||||
containerd.WithImageConfig(ctx, image),
|
||||
monitor.WithHtop,
|
||||
container, err := client.NewContainer(ctx, id,
|
||||
containerd.WithNewSpec(containerd.WithImageConfig(image), monitor.WithHtop),
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user