Service create/update set QueryRegistry appropriately

Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
Nishant Totla 2017-05-11 02:07:35 -07:00
parent b3e7e1ff74
commit c61ea6f789
No known key found for this signature in database
GPG Key ID: 7EA5781C9B3D0C19
3 changed files with 8 additions and 5 deletions

View File

@ -92,7 +92,7 @@ func runCreate(dockerCli *command.DockerCli, flags *pflag.FlagSet, opts *service
service.TaskTemplate.ContainerSpec.Configs = configs service.TaskTemplate.ContainerSpec.Configs = configs
} }
if err := resolveServiceImageDigest(dockerCli, &service); err != nil { if err := resolveServiceImageDigestContentTrust(dockerCli, &service); err != nil {
return err return err
} }
@ -106,6 +106,8 @@ func runCreate(dockerCli *command.DockerCli, flags *pflag.FlagSet, opts *service
createOpts.EncodedRegistryAuth = encodedAuth createOpts.EncodedRegistryAuth = encodedAuth
} }
createOpts.QueryRegistry = true
response, err := apiClient.ServiceCreate(ctx, service, createOpts) response, err := apiClient.ServiceCreate(ctx, service, createOpts)
if err != nil { if err != nil {
return err return err

View File

@ -15,10 +15,10 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
) )
func resolveServiceImageDigest(dockerCli command.Cli, service *swarm.ServiceSpec) error { func resolveServiceImageDigestContentTrust(dockerCli command.Cli, service *swarm.ServiceSpec) error {
if !command.IsTrusted() { if !command.IsTrusted() {
// Digests are resolved by the daemon when not using content // When not using content trust, digest resolution happens later when
// trust. // contacting the registry to retrieve image information.
return nil return nil
} }

View File

@ -164,9 +164,10 @@ func runUpdate(dockerCli *command.DockerCli, flags *pflag.FlagSet, options *serv
} }
if flags.Changed("image") { if flags.Changed("image") {
if err := resolveServiceImageDigest(dockerCli, spec); err != nil { if err := resolveServiceImageDigestContentTrust(dockerCli, spec); err != nil {
return err return err
} }
updateOpts.QueryRegistry = true
} }
updatedSecrets, err := getUpdatedSecrets(apiClient, flags, spec.TaskTemplate.ContainerSpec.Secrets) updatedSecrets, err := getUpdatedSecrets(apiClient, flags, spec.TaskTemplate.ContainerSpec.Secrets)