mirror of https://github.com/docker/cli.git
Service create/update set QueryRegistry appropriately
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
parent
b3e7e1ff74
commit
c61ea6f789
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue