mirror of https://github.com/docker/compose.git
Fix: image-defined entrypoint not overridden by intermediate container
This was causing recreation to hang.
This commit is contained in:
parent
b0ac88fd06
commit
a00ec9d1f8
|
@ -165,9 +165,9 @@ class Service(object):
|
|||
intermediate_container = Container.create(
|
||||
self.client,
|
||||
image=container.image,
|
||||
command='echo',
|
||||
volumes_from=container.id,
|
||||
entrypoint=None
|
||||
entrypoint=['echo'],
|
||||
command=[],
|
||||
)
|
||||
intermediate_container.start()
|
||||
intermediate_container.wait()
|
||||
|
|
|
@ -114,9 +114,16 @@ class ServiceTest(DockerClientTestCase):
|
|||
self.assertIn('/var/db', container.inspect()['Volumes'])
|
||||
|
||||
def test_recreate_containers(self):
|
||||
service = self.create_service('db', environment={'FOO': '1'}, volumes=['/var/db'], entrypoint=['ps'])
|
||||
service = self.create_service(
|
||||
'db',
|
||||
environment={'FOO': '1'},
|
||||
volumes=['/var/db'],
|
||||
entrypoint=['ps'],
|
||||
command=['ax']
|
||||
)
|
||||
old_container = service.create_container()
|
||||
self.assertEqual(old_container.dictionary['Config']['Entrypoint'], ['ps'])
|
||||
self.assertEqual(old_container.dictionary['Config']['Cmd'], ['ax'])
|
||||
self.assertIn('FOO=1', old_container.dictionary['Config']['Env'])
|
||||
self.assertEqual(old_container.name, 'figtest_db_1')
|
||||
service.start_container(old_container)
|
||||
|
@ -131,9 +138,10 @@ class ServiceTest(DockerClientTestCase):
|
|||
|
||||
new_container = new[0]
|
||||
intermediate_container = intermediate[0]
|
||||
self.assertEqual(intermediate_container.dictionary['Config']['Entrypoint'], None)
|
||||
self.assertEqual(intermediate_container.dictionary['Config']['Entrypoint'], ['echo'])
|
||||
|
||||
self.assertEqual(new_container.dictionary['Config']['Entrypoint'], ['ps'])
|
||||
self.assertEqual(new_container.dictionary['Config']['Cmd'], ['ax'])
|
||||
self.assertIn('FOO=2', new_container.dictionary['Config']['Env'])
|
||||
self.assertEqual(new_container.name, 'figtest_db_1')
|
||||
service.start_container(new_container)
|
||||
|
|
|
@ -22,12 +22,13 @@ class DockerClientTestCase(unittest.TestCase):
|
|||
self.client.remove_image(i)
|
||||
|
||||
def create_service(self, name, **kwargs):
|
||||
if 'command' not in kwargs:
|
||||
kwargs['command'] = ["/bin/sleep", "300"]
|
||||
return Service(
|
||||
project='figtest',
|
||||
name=name,
|
||||
client=self.client,
|
||||
image="ubuntu",
|
||||
command=["/bin/sleep", "300"],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue