community.docker
community.docker copied to clipboard
Allow list of files for env_file setting in docker_container
SUMMARY
docker-compose can fetch environment variables from multiple files, specified as list:
name:
container_name: name
image: /path/to/image
env_file:
- /path/environment1.env
- /path/environment2.env
However, this does not work with docker_container module. When specifying more than one env file, we get configuration error "file does not exist". I have environment settings split into multiple env files and only include relevant env for each container, however sometimes container must have access to variables located in multiple env files. This is currently not possible without dirty hacks with docker_container module.
ISSUE TYPE
- Feature Idea
COMPONENT NAME
docker_container module
ADDITIONAL INFORMATION
Example playbook:
- name: Create container
community.docker.docker_container:
name: name
image: /path/to/image
env_file:
- /path/environment1.env
- /path/environment2.env