diff --git a/changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml b/changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml new file mode 100644 index 000000000..c02d39607 --- /dev/null +++ b/changelogs/fragments/992-module-docker_compose_v2_run-fix-env-argument.yml @@ -0,0 +1,2 @@ +bugfixes: +- "docker_compose_v2_exec, docker_compose_v2_run - fix missing ``--env`` flag while assembling env arguments (https://github.com/ansible-collections/community.docker/pull/992)." \ No newline at end of file diff --git a/plugins/modules/docker_compose_v2_exec.py b/plugins/modules/docker_compose_v2_exec.py index 5590f77e1..bd3391d16 100644 --- a/plugins/modules/docker_compose_v2_exec.py +++ b/plugins/modules/docker_compose_v2_exec.py @@ -229,6 +229,7 @@ def get_exec_cmd(self, dry_run, no_start=False): args.append('--no-TTY') if self.env: for name, value in list(self.env.items()): + args.append('--env') args.append('{0}={1}'.format(name, value)) args.append('--') args.append(self.service) diff --git a/plugins/modules/docker_compose_v2_run.py b/plugins/modules/docker_compose_v2_run.py index c27a85c8b..6c8df8ed3 100644 --- a/plugins/modules/docker_compose_v2_run.py +++ b/plugins/modules/docker_compose_v2_run.py @@ -346,6 +346,7 @@ def get_run_cmd(self, dry_run, no_start=False): args.append('--no-TTY') if self.env: for name, value in list(self.env.items()): + args.append('--env') args.append('{0}={1}'.format(name, value)) args.append('--') args.append(self.service)