Skip to content

Commit edebf37

Browse files
committed
Split the entrypoint string to shell-like syntax.
1 parent 9bb6a6f commit edebf37

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docker/utils/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ def create_container_config(
564564
if isinstance(command, six.string_types):
565565
command = shlex.split(str(command))
566566

567+
if isinstance(entrypoint, six.string_types):
568+
entrypoint = shlex.split(str(entrypoint))
569+
567570
if isinstance(environment, dict):
568571
environment = [
569572
six.text_type('{0}={1}').format(k, v)

tests/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def test_create_container_with_ports(self):
428428
def test_create_container_with_entrypoint(self):
429429
try:
430430
self.client.create_container('busybox', 'hello',
431-
entrypoint='cowsay')
431+
entrypoint='cowsay entry')
432432
except Exception as e:
433433
self.fail('Command should not raise exception: {0}'.format(e))
434434

@@ -443,7 +443,7 @@ def test_create_container_with_entrypoint(self):
443443
"AttachStdout": true, "OpenStdin": false,
444444
"StdinOnce": false,
445445
"NetworkDisabled": false,
446-
"Entrypoint": "cowsay"}'''))
446+
"Entrypoint": ["cowsay", "entry"]}'''))
447447
self.assertEqual(args[1]['headers'],
448448
{'Content-Type': 'application/json'})
449449

0 commit comments

Comments
 (0)