diff --git a/cmd/skopeo/logout.go b/cmd/skopeo/logout.go index b47ccffb..839bbb6f 100644 --- a/cmd/skopeo/logout.go +++ b/cmd/skopeo/logout.go @@ -4,12 +4,14 @@ import ( "io" "github.com/containers/common/pkg/auth" + "github.com/containers/image/v5/types" "github.com/spf13/cobra" ) type logoutOptions struct { global *globalOptions logoutOpts auth.LogoutOptions + tlsVerify optionalBool } func logoutCmd(global *globalOptions) *cobra.Command { @@ -24,12 +26,17 @@ func logoutCmd(global *globalOptions) *cobra.Command { Example: `skopeo logout quay.io`, } adjustUsage(cmd) - cmd.Flags().AddFlagSet(auth.GetLogoutFlags(&opts.logoutOpts)) + flags := cmd.Flags() + optionalBoolFlag(flags, &opts.tlsVerify, "tls-verify", "require HTTPS and verify certificates when accessing the registry") + flags.AddFlagSet(auth.GetLogoutFlags(&opts.logoutOpts)) return cmd } func (opts *logoutOptions) run(args []string, stdout io.Writer) error { opts.logoutOpts.Stdout = stdout sys := opts.global.newSystemContext() + if opts.tlsVerify.present { + sys.DockerInsecureSkipTLSVerify = types.NewOptionalBool(!opts.tlsVerify.value) + } return auth.Logout(sys, &opts.logoutOpts, args) }