Skip to contentSkip to conversation

tests/docker: Use --userns=keep-id for podman

PATCH In review John Snow 2 participants 2 messages Sep 4, 2019 – Sep 5, 2019

lore
Share & tools
lore

John Snow

author
#0 lore raw

PATCH 1/1 tests/docker: Use --userns=keep-id for podman

The workaround that attempts to accomplish the same result as --userns=keep-id does not appear to work well with UIDs much above 1000 (like mine, which is above 20000.)

Since we have official support for this "trick" now, use the supported method.

---
 tests/docker/docker.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tests/docker/docker.py +1 -3
index ac5baab4ca..fe17d5f709 100755
@@ -368,9 +368,7 @@ class RunCommand(SubCommand):
             argv = [ "-u", str(uid) ] + argv
             docker = Docker()
             if docker._command[0] == "podman":
-                argv = [ "--uidmap", "%d:0:1" % uid,
-                         "--uidmap", "0:1:%d" % uid,
-                         "--uidmap", "%d:%d:64536" % (uid + 1, uid + 1)] + argv
+                argv.insert(0, '--userns=keep-id')
         return Docker().run(argv, args.keep, quiet=args.quiet)
 
 
Signature · 1 line
2.21.0
#1 lore raw
Quoted 7 lines · John Snow

The workaround that attempts to accomplish the same result as --userns=keep-id does not appear to work well with UIDs much above 1000 (like mine, which is above 20000.)

Since we have official support for this "trick" now, use the supported method.

Queued to testing/next, thanks.

Quoted 9 lines
---
 tests/docker/docker.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tests/docker/docker.py +0 -0
index ac5baab4ca..fe17d5f709 100755

tests/docker/docker.py class RunCommand(SubCommand): · line 372

Quoted 8 lines
tests/docker/docker.py +1 -3
@@ -368,9 +368,7 @@ class RunCommand(SubCommand):
             argv = [ "-u", str(uid) ] + argv
             docker = Docker()
             if docker._command[0] == "podman":
-                argv = [ "--uidmap", "%d:0:1" % uid,
-                         "--uidmap", "0:1:%d" % uid,
-                         "--uidmap", "%d:%d:64536" % (uid + 1, uid + 1)] + argv
+                argv.insert(0, '--userns=keep-id')
         return Docker().run(argv, args.keep, quiet=args.quiet)

--
Alex Bennée