diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-05-22 16:27:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-22 16:27:30 +0200 |
commit | e0376b9c3f9af07d9e58a04a7cd58a7c065305e3 (patch) | |
tree | 79827018a55478e0688033ee8130d81919be36c8 /cmd/podman/common.go | |
parent | 9db66b2fe346101b05e45f33ef38ed09e163f718 (diff) | |
parent | baed81029b74c8d801ea9d5cf67a78005472e6ed (diff) | |
download | podman-e0376b9c3f9af07d9e58a04a7cd58a7c065305e3.tar.gz podman-e0376b9c3f9af07d9e58a04a7cd58a7c065305e3.tar.bz2 podman-e0376b9c3f9af07d9e58a04a7cd58a7c065305e3.zip |
Merge pull request #3108 from rhatdan/flags
Fixup Flags
Diffstat (limited to 'cmd/podman/common.go')
-rw-r--r-- | cmd/podman/common.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cmd/podman/common.go b/cmd/podman/common.go index c0bcaa5c5..5e26d9bfd 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "path/filepath" "strings" "github.com/containers/buildah" @@ -163,6 +164,10 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { "Attach to STDIN, STDOUT or STDERR (default [])", ) createFlags.String( + "authfile", getAuthFile(""), + "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override", + ) + createFlags.String( "blkio-weight", "", "Block IO weight (relative weight) accepts a weight value between 10 and 1000.", ) @@ -553,7 +558,18 @@ func getAuthFile(authfile string) string { if authfile != "" { return authfile } - return os.Getenv("REGISTRY_AUTH_FILE") + if remote { + return "" + } + authfile = os.Getenv("REGISTRY_AUTH_FILE") + if authfile != "" { + return authfile + } + runtimeDir := os.Getenv("XDG_RUNTIME_DIR") + if runtimeDir != "" { + return filepath.Join(runtimeDir, "containers/auth.json") + } + return "" } // scrubServer removes 'http://' or 'https://' from the front of the |