diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-07 01:40:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-07 01:40:47 -0400 |
commit | 9b0627617ab35daf34f051352f3a6f05898ca935 (patch) | |
tree | 1f92ed024c5f7905b3c205ddd7a7b216eb0699d8 /libpod | |
parent | d83f49ef6b8a53535257bb56f5573ef3f65e3ba9 (diff) | |
parent | f230214db120793d68d95c5b1892ca5d7d128e79 (diff) | |
download | podman-9b0627617ab35daf34f051352f3a6f05898ca935.tar.gz podman-9b0627617ab35daf34f051352f3a6f05898ca935.tar.bz2 podman-9b0627617ab35daf34f051352f3a6f05898ca935.zip |
Merge pull request #9959 from Luap99/rootless-cni-path
rootless cni add /usr/sbin to PATH if not present
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/networking_linux.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 157c85431..3c4014c73 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -411,6 +411,16 @@ func (r *Runtime) getRootlessCNINetNs(new bool) (*rootlessCNI, error) { } } + // The CNI plugins need access to iptables in $PATH. As it turns out debian doesn't put + // /usr/sbin in $PATH for rootless users. This will break rootless cni completely. + // We might break existing users and we cannot expect everyone to change their $PATH so + // lets add /usr/sbin to $PATH ourselves. + path = os.Getenv("PATH") + if !strings.Contains(path, "/usr/sbin") { + path = path + ":/usr/sbin" + os.Setenv("PATH", path) + } + rootlessCNINS = &rootlessCNI{ ns: ns, dir: cniDir, |