Image returns the image that the container is based on
(ctx context.Context)
| 209 | |
| 210 | // Image returns the image that the container is based on |
| 211 | func (c *container) Image(ctx context.Context) (Image, error) { |
| 212 | r, err := c.get(ctx) |
| 213 | if err != nil { |
| 214 | return nil, err |
| 215 | } |
| 216 | if r.Image == "" { |
| 217 | return nil, fmt.Errorf("container not created from an image: %w", errdefs.ErrNotFound) |
| 218 | } |
| 219 | i, err := c.client.ImageService().Get(ctx, r.Image) |
| 220 | if err != nil { |
| 221 | return nil, fmt.Errorf("failed to get image %s for container: %w", r.Image, err) |
| 222 | } |
| 223 | return NewImage(c.client, i), nil |
| 224 | } |
| 225 | |
| 226 | func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...NewTaskOpts) (_ Task, retErr error) { |
| 227 | ctx, span := tracing.StartSpan(ctx, "container.NewTask") |
no test coverage detected