diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-07-05 11:37:15 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-07-05 13:30:15 +0000 |
commit | e38272047fbafb9fb35419e356d4576824585c23 (patch) | |
tree | be4714d3bf3ca80ba9556514dca8eef22a232171 /libpod/runtime.go | |
parent | 77758a6c9f74da42aad70ab74d6c68b2878d3ee0 (diff) | |
download | podman-e38272047fbafb9fb35419e356d4576824585c23.tar.gz podman-e38272047fbafb9fb35419e356d4576824585c23.tar.bz2 podman-e38272047fbafb9fb35419e356d4576824585c23.zip |
rootless: always set XDG_RUNTIME_DIR
containers/image uses XDG_RUNTIME_DIR to locate the auth file.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #1048
Approved by: mheon
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 1078c733e..6f751f959 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -217,6 +217,14 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) { if _, err := os.Stat(configPath); err != nil { foundConfig = false } + + // containers/image uses XDG_RUNTIME_DIR to locate the auth file. + // So make sure the env variable is set. + err = os.Setenv("XDG_RUNTIME_DIR", GetRootlessRuntimeDir()) + if err != nil { + return nil, errors.Wrapf(err, "cannot set XDG_RUNTIME_DIR") + } + } else if _, err := os.Stat(OverrideConfigPath); err == nil { // Use the override configuration path configPath = OverrideConfigPath |