diff --git a/fig/service.py b/fig/service.py index c4ebd85e8..d07f80d1b 100644 --- a/fig/service.py +++ b/fig/service.py @@ -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() diff --git a/tests/service_test.py b/tests/service_test.py index 01c1ecabb..63a31df56 100644 --- a/tests/service_test.py +++ b/tests/service_test.py @@ -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) diff --git a/tests/testcases.py b/tests/testcases.py index 7a6c8e4ad..6556311de 100644 --- a/tests/testcases.py +++ b/tests/testcases.py @@ -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 )