diff --git a/docker/utils/utils.py b/docker/utils/utils.py index 8dc726b349..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': user, + 'User': six.text_type(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..4fb2b8ff96 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -1624,3 +1624,9 @@ def test_649(self): ctnr = self.client.create_container('busybox', ['sleep', '2']) self.client.start(ctnr) self.client.stop(ctnr) + + def test_715(self): + 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'