diff --git a/compose/config/config.py b/compose/config/config.py index 4fddac822..861a3e9bf 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -128,7 +128,7 @@ SUPPORTED_FILENAMES = [ 'docker-compose.yaml', ] -DEFAULT_OVERRIDE_FILENAME = 'docker-compose.override.yml' +DEFAULT_OVERRIDE_FILENAMES = ('docker-compose.override.yml', 'docker-compose.override.yaml') log = logging.getLogger(__name__) @@ -292,8 +292,11 @@ def get_default_config_files(base_dir): def get_default_override_file(path): - override_filename = os.path.join(path, DEFAULT_OVERRIDE_FILENAME) - return [override_filename] if os.path.exists(override_filename) else [] + for default_override_filename in DEFAULT_OVERRIDE_FILENAMES: + override_filename = os.path.join(path, default_override_filename) + if os.path.exists(override_filename): + return [override_filename] + return [] def find_candidates_in_parent_dirs(filenames, path): diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index 30eff1b6a..f6c074364 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -2149,3 +2149,19 @@ class CLITestCase(DockerClientTestCase): assert 'busybox' in result.stdout assert 'multiplecomposefiles_another_1' in result.stdout assert 'multiplecomposefiles_simple_1' in result.stdout + + def test_up_with_override_yaml(self): + self.base_dir = 'tests/fixtures/override-yaml-files' + self._project = get_project(self.base_dir, []) + self.dispatch( + [ + 'up', '-d', + ], + None) + + containers = self.project.containers() + self.assertEqual(len(containers), 2) + + web, db = containers + self.assertEqual(web.human_readable_command, 'sleep 100') + self.assertEqual(db.human_readable_command, 'top') diff --git a/tests/fixtures/override-yaml-files/docker-compose.override.yaml b/tests/fixtures/override-yaml-files/docker-compose.override.yaml new file mode 100644 index 000000000..58c673482 --- /dev/null +++ b/tests/fixtures/override-yaml-files/docker-compose.override.yaml @@ -0,0 +1,3 @@ + +db: + command: "top" diff --git a/tests/fixtures/override-yaml-files/docker-compose.yml b/tests/fixtures/override-yaml-files/docker-compose.yml new file mode 100644 index 000000000..5f2909d69 --- /dev/null +++ b/tests/fixtures/override-yaml-files/docker-compose.yml @@ -0,0 +1,10 @@ + +web: + image: busybox:latest + command: "sleep 100" + links: + - db + +db: + image: busybox:latest + command: "sleep 200"