mirror of https://github.com/docker/docker-py.git
Split the entrypoint string to shell-like syntax.
This commit is contained in:
parent
9bb6a6fd56
commit
edebf3756a
|
@ -564,6 +564,9 @@ def create_container_config(
|
||||||
if isinstance(command, six.string_types):
|
if isinstance(command, six.string_types):
|
||||||
command = shlex.split(str(command))
|
command = shlex.split(str(command))
|
||||||
|
|
||||||
|
if isinstance(entrypoint, six.string_types):
|
||||||
|
entrypoint = shlex.split(str(entrypoint))
|
||||||
|
|
||||||
if isinstance(environment, dict):
|
if isinstance(environment, dict):
|
||||||
environment = [
|
environment = [
|
||||||
six.text_type('{0}={1}').format(k, v)
|
six.text_type('{0}={1}').format(k, v)
|
||||||
|
|
|
@ -428,7 +428,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
|
||||||
def test_create_container_with_entrypoint(self):
|
def test_create_container_with_entrypoint(self):
|
||||||
try:
|
try:
|
||||||
self.client.create_container('busybox', 'hello',
|
self.client.create_container('busybox', 'hello',
|
||||||
entrypoint='cowsay')
|
entrypoint='cowsay entry')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail('Command should not raise exception: {0}'.format(e))
|
self.fail('Command should not raise exception: {0}'.format(e))
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
|
||||||
"AttachStdout": true, "OpenStdin": false,
|
"AttachStdout": true, "OpenStdin": false,
|
||||||
"StdinOnce": false,
|
"StdinOnce": false,
|
||||||
"NetworkDisabled": false,
|
"NetworkDisabled": false,
|
||||||
"Entrypoint": "cowsay"}'''))
|
"Entrypoint": ["cowsay", "entry"]}'''))
|
||||||
self.assertEqual(args[1]['headers'],
|
self.assertEqual(args[1]['headers'],
|
||||||
{'Content-Type': 'application/json'})
|
{'Content-Type': 'application/json'})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue