From 09defa66ba4f4fcea35cbc004fc1de54155911bf Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 31 Aug 2015 16:06:52 -0700 Subject: [PATCH 1/3] Always send a string for the user param in create_container --- docker/utils/utils.py | 2 +- tests/integration_test.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/utils/utils.py b/docker/utils/utils.py index 8dc726b349..71511a4f87 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -715,7 +715,7 @@ def create_container_config( 'Hostname': hostname, 'Domainname': domainname, 'ExposedPorts': ports, - 'User': user, + 'User': '{0}'.format(user) if user else None, 'Tty': tty, 'OpenStdin': stdin_open, 'StdinOnce': stdin_once, diff --git a/tests/integration_test.py b/tests/integration_test.py index fd4ff2d08d..db4d131be5 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -1624,3 +1624,6 @@ def test_649(self): ctnr = self.client.create_container('busybox', ['sleep', '2']) self.client.start(ctnr) self.client.stop(ctnr) + + def test_715(self): + self.client.create_container('busybox', 'true', user=1000) From add97869554e7c84724988c12a46604586a4d7ad Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 31 Aug 2015 18:30:13 -0700 Subject: [PATCH 2/3] Use six.text_type --- docker/utils/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/utils/utils.py b/docker/utils/utils.py index 71511a4f87..c49b3e5857 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -715,7 +715,7 @@ def create_container_config( 'Hostname': hostname, 'Domainname': domainname, 'ExposedPorts': ports, - 'User': '{0}'.format(user) if user else None, + 'User': six.text_type(user) if user else None, 'Tty': tty, 'OpenStdin': stdin_open, 'StdinOnce': stdin_once, From 1e916a1e83af49bc8d2fd5026ca9746129d1cebc Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 31 Aug 2015 18:35:32 -0700 Subject: [PATCH 3/3] Test UID validity --- tests/integration_test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/integration_test.py b/tests/integration_test.py index db4d131be5..4fb2b8ff96 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -1626,4 +1626,7 @@ def test_649(self): self.client.stop(ctnr) def test_715(self): - self.client.create_container('busybox', 'true', user=1000) + ctnr = self.client.create_container('busybox', ['id', '-u'], user=1000) + self.client.start(ctnr) + self.client.wait(ctnr) + assert self.client.logs(ctnr) == '1000\n'