Allow user=0 to be passed in create_container

Signed-off-by: Anthony Sottile <asottile@umich.edu>
This commit is contained in:
Anthony Sottile 2018-08-02 12:00:11 -07:00
parent 64a1d8c69a
commit 3c9738a584
2 changed files with 7 additions and 1 deletions

View File

@ -578,7 +578,7 @@ class ContainerConfig(dict):
'Hostname': hostname,
'Domainname': domainname,
'ExposedPorts': ports,
'User': six.text_type(user) if user else None,
'User': six.text_type(user) if user is not None else None,
'Tty': tty,
'OpenStdin': stdin_open,
'StdinOnce': stdin_once,

View File

@ -0,0 +1,6 @@
from docker.types.containers import ContainerConfig
def test_uid_0_is_not_elided():
x = ContainerConfig(image='i', version='v', command='true', user=0)
assert x['User'] == '0'