From 4f857bc10627d950b3363e47cee02ef07618f0ae Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 14 Oct 2021 14:50:26 -0400 Subject: If CONTAINER_HOST env variable is set default podman --remote=true Users enabling CONTAINER_HOST==PATH is indicating to podman they intend to use remote functionality. Fixes: https://github.com/containers/podman/issues/11196 Update man pages to document all of the environment variables. Signed-off-by: Daniel J Walsh --- cmd/podman/root.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/podman/root.go b/cmd/podman/root.go index eb30f1ef6..734636646 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -314,7 +314,15 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) { lFlags.StringVar(&opts.Identity, identityFlagName, ident, "path to SSH identity file, (CONTAINER_SSHKEY)") _ = cmd.RegisterFlagCompletionFunc(identityFlagName, completion.AutocompleteDefault) - lFlags.BoolVarP(&opts.Remote, "remote", "r", false, "Access remote Podman service (default false)") + remote := false + if env, ok := os.LookupEnv("CONTAINER_HOST"); ok { + logrus.Infof("CONTAINER_HOST==%q, defaulting to '--remote=true'", env) + remote = true + } else if env, ok := os.LookupEnv("CONTAINER_CONNECTION"); ok { + logrus.Infof("CONTAINER_CONNECTION==%q, defaulting to '--remote=true'", env) + remote = true + } + lFlags.BoolVarP(&opts.Remote, "remote", "r", remote, "Access remote Podman service") pFlags := cmd.PersistentFlags() if registry.IsRemote() { if err := lFlags.MarkHidden("remote"); err != nil { -- cgit v1.2.3-54-g00ecf