diff options
author | Anthony Sottile <asottile@umich.edu> | 2018-08-02 12:00:11 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2018-08-09 17:11:47 -0700 |
commit | cbc7623ea09fd63a75f74378da11bd7cf266e32c (patch) | |
tree | be7678cd655fd0ae3c84c303fd1cd0ee5b3d6375 | |
parent | 8ee446631d6da7ca8e52a4f65aafecf2de1c8ea6 (diff) | |
download | docker-py-cbc7623ea09fd63a75f74378da11bd7cf266e32c.tar.gz |
Allow user=0 to be passed in create_container
Signed-off-by: Anthony Sottile <asottile@umich.edu>
-rw-r--r-- | docker/types/containers.py | 2 | ||||
-rw-r--r-- | tests/unit/types_containers_test.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/docker/types/containers.py b/docker/types/containers.py index e7841bc..9dfea8c 100644 --- a/docker/types/containers.py +++ b/docker/types/containers.py @@ -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, diff --git a/tests/unit/types_containers_test.py b/tests/unit/types_containers_test.py new file mode 100644 index 0000000..b0ad0a7 --- /dev/null +++ b/tests/unit/types_containers_test.py @@ -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' |