diff --git a/compose/service.py b/compose/service.py index b3d911135..f79a46962 100644 --- a/compose/service.py +++ b/compose/service.py @@ -849,10 +849,10 @@ class Service(object): override_options['mounts'] = [build_mount(v) for v in container_mounts] or None else: # Workaround for 3.2 format - self.options['tmpfs'] = self.options.get('tmpfs') or [] + override_options['tmpfs'] = self.options.get('tmpfs') or [] for m in container_mounts: if m.is_tmpfs: - self.options['tmpfs'].append(m.target) + override_options['tmpfs'].append(m.target) else: override_options['binds'].append(m.legacy_repr()) container_options['volumes'][m.target] = {} diff --git a/tests/unit/service_test.py b/tests/unit/service_test.py index 21bac8b83..002ae0c0d 100644 --- a/tests/unit/service_test.py +++ b/tests/unit/service_test.py @@ -13,6 +13,7 @@ from compose.config.types import ServicePort from compose.config.types import ServiceSecret from compose.config.types import VolumeFromSpec from compose.config.types import VolumeSpec +from compose.const import API_VERSIONS from compose.const import LABEL_CONFIG_HASH from compose.const import LABEL_ONE_OFF from compose.const import LABEL_PROJECT @@ -599,6 +600,25 @@ class ServiceTest(unittest.TestCase): } assert config_dict == expected + def test_config_hash_matches_label(self): + self.mock_client.inspect_image.return_value = {'Id': 'abcd'} + service = Service( + 'foo', + image='example.com/foo', + client=self.mock_client, + network_mode=NetworkMode('bridge'), + networks={'bridge': {}}, + links=[(Service('one', client=self.mock_client), 'one')], + volumes_from=[VolumeFromSpec(Service('two', client=self.mock_client), 'rw', 'service')] + ) + config_hash = service.config_hash + + for api_version in set(API_VERSIONS.values()): + self.mock_client.api_version = api_version + assert service._get_container_create_options({}, 1)['labels'][LABEL_CONFIG_HASH] == ( + config_hash + ) + def test_remove_image_none(self): web = Service('web', image='example', client=self.mock_client) assert not web.remove_image(ImageType.none)