summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Huang <sidawei@gmail.com>2015-08-25 09:44:47 +0800
committerColin Huang <sidawei@gmail.com>2015-08-25 09:44:47 +0800
commitedebf3756a9b3d28db6fc70341a14315e771b5f7 (patch)
treed89c5bc8b7457e997adcc1e68f48ddaa12dd7899
parent9bb6a6fd5649e33af88242b09fa0a5d979ea9220 (diff)
downloaddocker-py-edebf3756a9b3d28db6fc70341a14315e771b5f7.tar.gz
Split the entrypoint string to shell-like syntax.
-rw-r--r--docker/utils/utils.py3
-rw-r--r--tests/test.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index a3b63f4..9c4680b 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -564,6 +564,9 @@ def create_container_config(
if isinstance(command, six.string_types):
command = shlex.split(str(command))
+ if isinstance(entrypoint, six.string_types):
+ entrypoint = shlex.split(str(entrypoint))
+
if isinstance(environment, dict):
environment = [
six.text_type('{0}={1}').format(k, v)
diff --git a/tests/test.py b/tests/test.py
index 5295763..4a8a871 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -428,7 +428,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
def test_create_container_with_entrypoint(self):
try:
self.client.create_container('busybox', 'hello',
- entrypoint='cowsay')
+ entrypoint='cowsay entry')
except Exception as e:
self.fail('Command should not raise exception: {0}'.format(e))
@@ -443,7 +443,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
"AttachStdout": true, "OpenStdin": false,
"StdinOnce": false,
"NetworkDisabled": false,
- "Entrypoint": "cowsay"}'''))
+ "Entrypoint": ["cowsay", "entry"]}'''))
self.assertEqual(args[1]['headers'],
{'Content-Type': 'application/json'})