Skip to content

Commit

Permalink
Enable UID GID persistence in podman
Browse files Browse the repository at this point in the history
  • Loading branch information
tfoote committed Nov 15, 2024
1 parent 830d70b commit 80a0176
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rocker/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ class User(RockerExtension):
def get_name():
return 'user'

def get_docker_args(self, cliargs):
if cliargs.get('use_podman', False):
return ' --userns=keep-id '
return ''

def get_environment_subs(self):
if not self._env_subs:
user_vars = ['name', 'uid', 'gid', 'gecos','dir', 'shell']
Expand Down
8 changes: 8 additions & 0 deletions test/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@ def test_user_extension(self):
snippet_result = p.get_snippet(user_override_active_cliargs)
self.assertFalse('-s' in snippet_result)

user_podman_args = mock_cliargs
args_result = p.get_docker_args(user_podman_args)
self.assertNotIn('--userns=keep-id', args_result)

user_podman_args['use_podman'] = True
args_result = p.get_docker_args(user_podman_args)
self.assertIn('--userns=keep-id', args_result)

@pytest.mark.docker
def test_user_collisions(self):
plugins = list_plugins()
Expand Down

0 comments on commit 80a0176

Please sign in to comment.