Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using docker-compose.yml.dist #1999

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion compose/config/config.py
Expand Up @@ -71,6 +71,7 @@

SUPPORTED_FILENAMES = [
'docker-compose.yml',
'docker-compose.yml.dist',
'docker-compose.yaml',
'fig.yml',
'fig.yaml',
Expand Down Expand Up @@ -109,7 +110,7 @@ def get_config_path(base_dir):

winner = candidates[0]

if len(candidates) > 1:
if len(candidates) > 1 and not (len(candidates) == 2 and candidates[1].endswith('.dist')):
log.warn("Found multiple config files with supported names: %s", ", ".join(candidates))
log.warn("Using %s\n", winner)

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Expand Up @@ -206,7 +206,7 @@ At this point, you have seen the basics of how Compose works.

## Release Notes

To see a detailed list of changes for past and current releases of Docker
To see a detailed list of changes for past and current releases of Docker
Compose, please refer to the [CHANGELOG](https://github.com/docker/compose/blob/master/CHANGELOG.md).

## Getting help
Expand Down
15 changes: 9 additions & 6 deletions tests/unit/config_test.py
Expand Up @@ -1059,6 +1059,7 @@ class GetConfigPathTestCase(unittest.TestCase):

files = [
'docker-compose.yml',
'docker-compose.yml.dist',
'docker-compose.yaml',
'fig.yml',
'fig.yaml',
Expand All @@ -1067,9 +1068,10 @@ class GetConfigPathTestCase(unittest.TestCase):
def test_get_config_path_default_file_in_basedir(self):
files = self.files
self.assertEqual('docker-compose.yml', get_config_filename_for_files(files[0:]))
self.assertEqual('docker-compose.yaml', get_config_filename_for_files(files[1:]))
self.assertEqual('fig.yml', get_config_filename_for_files(files[2:]))
self.assertEqual('fig.yaml', get_config_filename_for_files(files[3:]))
self.assertEqual('docker-compose.yml.dist', get_config_filename_for_files(files[1:]))
self.assertEqual('docker-compose.yaml', get_config_filename_for_files(files[2:]))
self.assertEqual('fig.yml', get_config_filename_for_files(files[3:]))
self.assertEqual('fig.yaml', get_config_filename_for_files(files[4:]))
with self.assertRaises(config.ComposeFileNotFound):
get_config_filename_for_files([])

Expand All @@ -1081,9 +1083,10 @@ def get_config_in_subdir(files):
return get_config_filename_for_files(files, subdir=True)

self.assertEqual('docker-compose.yml', get_config_in_subdir(files[0:]))
self.assertEqual('docker-compose.yaml', get_config_in_subdir(files[1:]))
self.assertEqual('fig.yml', get_config_in_subdir(files[2:]))
self.assertEqual('fig.yaml', get_config_in_subdir(files[3:]))
self.assertEqual('docker-compose.yml.dist', get_config_in_subdir(files[1:]))
self.assertEqual('docker-compose.yaml', get_config_in_subdir(files[2:]))
self.assertEqual('fig.yml', get_config_in_subdir(files[3:]))
self.assertEqual('fig.yaml', get_config_in_subdir(files[4:]))
with self.assertRaises(config.ComposeFileNotFound):
get_config_in_subdir([])

Expand Down