mirror of https://github.com/docker/cli.git
Adding a flag to allow disabling registry lookup
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
parent
c61ea6f789
commit
39d03bb2bd
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"golang.org/x/net/context"
|
||||
|
@ -106,7 +107,10 @@ func runCreate(dockerCli *command.DockerCli, flags *pflag.FlagSet, opts *service
|
|||
createOpts.EncodedRegistryAuth = encodedAuth
|
||||
}
|
||||
|
||||
// query registry if flag disabling it was not set
|
||||
if !opts.noResolveImage && versions.GreaterThanOrEqualTo(apiClient.ClientVersion(), "1.30") {
|
||||
createOpts.QueryRegistry = true
|
||||
}
|
||||
|
||||
response, err := apiClient.ServiceCreate(ctx, service, createOpts)
|
||||
if err != nil {
|
||||
|
|
|
@ -543,6 +543,7 @@ type serviceOptions struct {
|
|||
endpoint endpointOptions
|
||||
|
||||
registryAuth bool
|
||||
noResolveImage bool
|
||||
|
||||
logDriver logDriverOptions
|
||||
|
||||
|
@ -797,6 +798,8 @@ func addServiceFlags(flags *pflag.FlagSet, opts *serviceOptions, defaultFlagValu
|
|||
flags.StringVar(&opts.endpoint.mode, flagEndpointMode, defaultFlagValues.getString(flagEndpointMode), "Endpoint mode (vip or dnsrr)")
|
||||
|
||||
flags.BoolVar(&opts.registryAuth, flagRegistryAuth, false, "Send registry authentication details to swarm agents")
|
||||
flags.BoolVar(&opts.noResolveImage, flagNoResolveImage, false, "Do not query the registry to resolve image digest and supported platforms")
|
||||
flags.SetAnnotation(flagNoResolveImage, "version", []string{"1.30"})
|
||||
|
||||
flags.StringVar(&opts.logDriver.name, flagLogDriver, "", "Logging driver for service")
|
||||
flags.Var(&opts.logDriver.opts, flagLogOpt, "Logging driver options")
|
||||
|
@ -899,6 +902,7 @@ const (
|
|||
flagUser = "user"
|
||||
flagWorkdir = "workdir"
|
||||
flagRegistryAuth = "with-registry-auth"
|
||||
flagNoResolveImage = "no-resolve-image"
|
||||
flagLogDriver = "log-driver"
|
||||
flagLogOpt = "log-opt"
|
||||
flagHealthCmd = "health-cmd"
|
||||
|
|
|
@ -167,8 +167,10 @@ func runUpdate(dockerCli *command.DockerCli, flags *pflag.FlagSet, options *serv
|
|||
if err := resolveServiceImageDigestContentTrust(dockerCli, spec); err != nil {
|
||||
return err
|
||||
}
|
||||
if !options.noResolveImage && versions.GreaterThanOrEqualTo(apiClient.ClientVersion(), "1.30") {
|
||||
updateOpts.QueryRegistry = true
|
||||
}
|
||||
}
|
||||
|
||||
updatedSecrets, err := getUpdatedSecrets(apiClient, flags, spec.TaskTemplate.ContainerSpec.Secrets)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue