You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Furthermore, this appears to make it impossible to manage any project that is using Multiple Compose Files.
In our use case, we have a docker-compose.base.yml file which gets merged with additional file(s) depending on environment. The files to be loaded is controlled via the .env file's COMPOSE_FILE variable. This functionality is supported according to Docker's documentation and functions as expected outside of Ansible. Additionally, it was operating via Ansible as expected when we were using community.docker.docker_compose.
Include the files parameter (source) in your Ansible playbook
Are you saying that this doesn't work? From the code it should not complain about a missing file in ('compose.yaml', 'compose.yml', 'docker-compose.yaml', 'docker-compose.yml') if the files option is specified.
Include COMPOSE_FILE=docker-compose.base.yml in /path/to/project/.env
Include the env_files parameter (source) in your Ansible playbook (shouldn't be necessary, because .env is default)
I don't think it's a good idea to re-implement all this specific logic in the Python code (it does work for the old docker_compose because that one literally includes Docker Compose itself and uses its logic).
I'm currently thinking about either simply disabling the check, or allowing the user to disable it. The latter has the advantage that in most cases, none of the files ('compose.yaml', 'compose.yml', 'docker-compose.yaml', 'docker-compose.yml') being there is likely a user mistake.
SUMMARY
Ansible is unable to operate if the
project_src
does not have one of the hard-codedDOCKER_COMPOSE_FILES
listed (source).Furthermore, this appears to make it impossible to manage any project that is using Multiple Compose Files.
In our use case, we have a
docker-compose.base.yml
file which gets merged with additional file(s) depending on environment. The files to be loaded is controlled via the.env
file'sCOMPOSE_FILE
variable. This functionality is supported according to Docker's documentation and functions as expected outside of Ansible. Additionally, it was operating via Ansible as expected when we were usingcommunity.docker.docker_compose
.ISSUE TYPE
COMPONENT NAME
community.docker.docker_compose_v2
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Target OS: Ubuntu 22.04.4
STEPS TO REPRODUCE
('compose.yaml', 'compose.yml', 'docker-compose.yaml', 'docker-compose.yml')
docker-compose.base.yml
COMPOSE_FILE=docker-compose.base.yml
in/path/to/project/.env
env_files
parameter (source) in your Ansible playbook (shouldn't be necessary, because.env
is default)files
parameter (source) in your Ansible playbookEXPECTED RESULTS
The container(s) are stopped.
ACTUAL RESULTS
An error is raised:
The same error is described in #756 and was addressed in #759, but that only added additional options to the hard-coded standard file names.
The text was updated successfully, but these errors were encountered: