imageservice: Add context to various methods

Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Nicolas De Loof
2022-10-26 18:13:17 +02:00
committed by Paweł Gronowski
parent 4c07d58592
commit def549c8f6
40 changed files with 303 additions and 256 deletions

View File

@@ -1,6 +1,7 @@
package daemon // import "github.com/docker/docker/daemon"
import (
"context"
"fmt"
"runtime"
"strings"
@@ -116,7 +117,7 @@ func merge(userConf, imageConf *containertypes.Config) error {
// CreateImageFromContainer creates a new image from a container. The container
// config will be updated by applying the change set to the custom config, then
// applying that config over the existing container config.
func (daemon *Daemon) CreateImageFromContainer(name string, c *backend.CreateImageConfig) (string, error) {
func (daemon *Daemon) CreateImageFromContainer(ctx context.Context, name string, c *backend.CreateImageConfig) (string, error) {
start := time.Now()
container, err := daemon.GetContainer(name)
if err != nil {
@@ -146,7 +147,7 @@ func (daemon *Daemon) CreateImageFromContainer(name string, c *backend.CreateIma
if c.Config == nil {
c.Config = container.Config
}
newConfig, err := dockerfile.BuildFromConfig(c.Config, c.Changes, container.OS)
newConfig, err := dockerfile.BuildFromConfig(ctx, c.Config, c.Changes, container.OS)
if err != nil {
return "", err
}