mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-03 12:11:41 +00:00
Merge pull request #16567 from calavera/context_per_request
Define a context per request.
This commit is contained in:
@@ -209,7 +209,7 @@ func from(ctx context.Context, b *builder, args []string, attributes map[string]
|
||||
return nil
|
||||
}
|
||||
|
||||
image, err := b.Daemon.Repositories(ctx).LookupImage(name)
|
||||
image, err := b.Daemon.Repositories().LookupImage(name)
|
||||
if b.Pull {
|
||||
image, err = b.pullImage(ctx, name)
|
||||
if err != nil {
|
||||
@@ -217,7 +217,7 @@ func from(ctx context.Context, b *builder, args []string, attributes map[string]
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
if b.Daemon.Graph(ctx).IsNotExist(err, name) {
|
||||
if b.Daemon.Graph().IsNotExist(err, name) {
|
||||
image, err = b.pullImage(ctx, name)
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ func (b *builder) commit(ctx context.Context, id string, autoCmd *stringutils.St
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.Daemon.Graph(ctx).Retain(b.id, image.ID)
|
||||
b.Daemon.Graph().Retain(b.id, image.ID)
|
||||
b.activeImages = append(b.activeImages, image.ID)
|
||||
b.image = image.ID
|
||||
return nil
|
||||
@@ -516,11 +516,11 @@ func (b *builder) pullImage(ctx context.Context, name string) (*image.Image, err
|
||||
OutStream: ioutils.NopWriteCloser(b.OutOld),
|
||||
}
|
||||
|
||||
if err := b.Daemon.Repositories(ctx).Pull(ctx, remote, tag, imagePullConfig); err != nil {
|
||||
if err := b.Daemon.Repositories().Pull(ctx, remote, tag, imagePullConfig); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
image, err := b.Daemon.Repositories(ctx).LookupImage(name)
|
||||
image, err := b.Daemon.Repositories().LookupImage(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -600,7 +600,7 @@ func (b *builder) probeCache(ctx context.Context) (bool, error) {
|
||||
fmt.Fprintf(b.OutStream, " ---> Using cache\n")
|
||||
logrus.Debugf("[BUILDER] Use cached version")
|
||||
b.image = cache.ID
|
||||
b.Daemon.Graph(ctx).Retain(b.id, cache.ID)
|
||||
b.Daemon.Graph().Retain(b.id, cache.ID)
|
||||
b.activeImages = append(b.activeImages, cache.ID)
|
||||
return true, nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -230,7 +230,7 @@ func Build(ctx context.Context, d *daemon.Daemon, buildConfig *Config) error {
|
||||
}
|
||||
|
||||
defer func() {
|
||||
builder.Daemon.Graph(ctx).Release(builder.id, builder.activeImages...)
|
||||
builder.Daemon.Graph().Release(builder.id, builder.activeImages...)
|
||||
}()
|
||||
|
||||
id, err := builder.Run(ctx, context)
|
||||
@@ -238,7 +238,7 @@ func Build(ctx context.Context, d *daemon.Daemon, buildConfig *Config) error {
|
||||
return err
|
||||
}
|
||||
if repoName != "" {
|
||||
return d.Repositories(ctx).Tag(repoName, tag, id, true)
|
||||
return d.Repositories().Tag(repoName, tag, id, true)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user