From d6cd76c3c153b79fa0ceec5c84c984a65a4c41f3 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Sun, 21 Jun 2015 17:25:46 -0700 Subject: [PATCH] Merge pull request #1570 from aanand/fix-build-pull Explicitly set pull=False when building (cherry picked from commit 4f83a1891259bd821efb6c8f2332f06405e88732) Signed-off-by: Aanand Prasad --- compose/service.py | 1 + tests/unit/service_test.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/compose/service.py b/compose/service.py index 12a021bfb2..6c2cc4da59 100644 --- a/compose/service.py +++ b/compose/service.py @@ -628,6 +628,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 fb3a7fcbb9..88d3014702 100644 --- a/tests/unit/service_test.py +++ b/tests/unit/service_test.py @@ -303,6 +303,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):