Skip to content

Commit d4f13e4

Browse files
committed
Relaxed checking of userns_mode
When using docker-compose in combination with rootless podman containers it is desirable to use the keep-id user namespace mapping. By lifting the restriction to 'host' the userns_mode config can now be used with podman to supply the keep-id or more complex configurations. Signed-off-by: Jonathan Hettwer (bauen1) <[email protected]>
1 parent bd164f9 commit d4f13e4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docker/types/containers.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,13 @@ def __init__(self, version, binds=None, port_bindings=None,
544544
if version_lt(version, '1.23'):
545545
raise host_config_version_error('userns_mode', '1.23')
546546

547-
if userns_mode != "host":
548-
raise host_config_value_error("userns_mode", userns_mode)
547+
# Do not check that userns_mode has a specific value, i.e. 'host'
548+
# since more complex values might be supported by the daemon exposing
549+
# the docker api, e.g. podman also supports 'keep-id'
550+
551+
if not isinstance(userns_mode, str):
552+
raise host_config_type_error('userns_mode', userns_mode, 'string')
553+
549554
self['UsernsMode'] = userns_mode
550555

551556
if uts_mode:

0 commit comments

Comments
 (0)