diff --git a/compose/service.py b/compose/service.py index 53073ffbd..eec022568 100644 --- a/compose/service.py +++ b/compose/service.py @@ -612,6 +612,7 @@ class Service(object): tag=self.image_name, stream=True, rm=True, + pull=False, nocache=no_cache, dockerfile=self.options.get('dockerfile', None), ) diff --git a/tests/unit/service_test.py b/tests/unit/service_test.py index 82ea04101..f99cbbc9d 100644 --- a/tests/unit/service_test.py +++ b/tests/unit/service_test.py @@ -312,6 +312,17 @@ class ServiceTest(unittest.TestCase): with self.assertRaises(NeedsBuildError): service.create_container(do_build=False) + def test_build_does_not_pull(self): + self.mock_client.build.return_value = [ + '{"stream": "Successfully built 12345"}', + ] + + service = Service('foo', client=self.mock_client, build='.') + service.build() + + self.assertEqual(self.mock_client.build.call_count, 1) + self.assertFalse(self.mock_client.build.call_args[1]['pull']) + class ServiceVolumesTest(unittest.TestCase):