@@ -1030,7 +1030,7 @@ func (daemon *Daemon) PullImage(ctx context.Context, ref reference.Named, metaHe
1030
1030
}
1031
1031
1032
1032
// PullOnBuild tells Docker to pull image referenced by `name`.
1033
- func (daemon * Daemon ) PullOnBuild (name string , authConfigs map [string ]types.AuthConfig , output io.Writer ) (builder.Image , error ) {
1033
+ func (daemon * Daemon ) PullOnBuild (ctx context. Context , name string , authConfigs map [string ]types.AuthConfig , output io.Writer ) (builder.Image , error ) {
1034
1034
ref , err := reference .ParseNamed (name )
1035
1035
if err != nil {
1036
1036
return nil , err
@@ -1052,7 +1052,7 @@ func (daemon *Daemon) PullOnBuild(name string, authConfigs map[string]types.Auth
1052
1052
pullRegistryAuth = & resolvedConfig
1053
1053
}
1054
1054
1055
- if err := daemon .PullImage (context . Background () , ref , nil , pullRegistryAuth , output ); err != nil {
1055
+ if err := daemon .PullImage (ctx , ref , nil , pullRegistryAuth , output ); err != nil {
1056
1056
return nil , err
1057
1057
}
1058
1058
return daemon .GetImage (name )
@@ -1069,14 +1069,14 @@ func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
1069
1069
}
1070
1070
1071
1071
// PushImage initiates a push operation on the repository named localName.
1072
- func (daemon * Daemon ) PushImage (ref reference.Named , metaHeaders map [string ][]string , authConfig * types.AuthConfig , outStream io.Writer ) error {
1072
+ func (daemon * Daemon ) PushImage (ctx context. Context , ref reference.Named , metaHeaders map [string ][]string , authConfig * types.AuthConfig , outStream io.Writer ) error {
1073
1073
// Include a buffer so that slow client connections don't affect
1074
1074
// transfer performance.
1075
1075
progressChan := make (chan progress.Progress , 100 )
1076
1076
1077
1077
writesDone := make (chan struct {})
1078
1078
1079
- ctx , cancelFunc := context .WithCancel (context . Background () )
1079
+ ctx , cancelFunc := context .WithCancel (ctx )
1080
1080
1081
1081
go func () {
1082
1082
writeDistributionProgress (cancelFunc , outStream , progressChan )
@@ -1502,16 +1502,16 @@ func configureVolumes(config *Config, rootUID, rootGID int) (*store.VolumeStore,
1502
1502
}
1503
1503
1504
1504
// AuthenticateToRegistry checks the validity of credentials in authConfig
1505
- func (daemon * Daemon ) AuthenticateToRegistry (authConfig * types.AuthConfig ) (string , string , error ) {
1506
- return daemon .RegistryService .Auth (authConfig , dockerversion .DockerUserAgent ("" ))
1505
+ func (daemon * Daemon ) AuthenticateToRegistry (ctx context. Context , authConfig * types.AuthConfig ) (string , string , error ) {
1506
+ return daemon .RegistryService .Auth (authConfig , dockerversion .DockerUserAgent (ctx ))
1507
1507
}
1508
1508
1509
1509
// SearchRegistryForImages queries the registry for images matching
1510
1510
// term. authConfig is used to login.
1511
- func (daemon * Daemon ) SearchRegistryForImages (term string ,
1511
+ func (daemon * Daemon ) SearchRegistryForImages (ctx context. Context , term string ,
1512
1512
authConfig * types.AuthConfig ,
1513
1513
headers map [string ][]string ) (* registrytypes.SearchResults , error ) {
1514
- return daemon .RegistryService .Search (term , authConfig , dockerversion .DockerUserAgent ("" ), headers )
1514
+ return daemon .RegistryService .Search (term , authConfig , dockerversion .DockerUserAgent (ctx ), headers )
1515
1515
}
1516
1516
1517
1517
// IsShuttingDown tells whether the daemon is shutting down or not
0 commit comments