diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-15 16:50:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 16:50:49 +0200 |
commit | 3f6fd8a7bd4f4fc3cfbfb1329814a5db016b1a6c (patch) | |
tree | d33390f407abdba102aa0fa7e79baa56791fc8a8 /cmd/podman/root.go | |
parent | 5ac617ae8af1797f8444d89290646692c14c6b1e (diff) | |
parent | 4f857bc10627d950b3363e47cee02ef07618f0ae (diff) | |
download | podman-3f6fd8a7bd4f4fc3cfbfb1329814a5db016b1a6c.tar.gz podman-3f6fd8a7bd4f4fc3cfbfb1329814a5db016b1a6c.tar.bz2 podman-3f6fd8a7bd4f4fc3cfbfb1329814a5db016b1a6c.zip |
Merge pull request #11978 from rhatdan/remote
If CONTAINER_HOST env variable is set default podman --remote=true
Diffstat (limited to 'cmd/podman/root.go')
-rw-r--r-- | cmd/podman/root.go | 10 |
1 files changed, 9 insertions, 1 deletions
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 { |