community.docker
community.docker copied to clipboard
Pass envs to docker-compose
I am tryting to pass envs to use it like
services:
rabbit:
restart: always
image: rabbitmq
volumes:
- ${DATABASES_FOLDER}/rabbit:/var/lib/rabbitmq
I did standard environment attribute, but it doesn't work for me. They don't pass to my docker compose file that I use in ansible like
environment:
DATABASES_FOLDER: /
tasks:
- ansible.builtin.copy:
src: ./docker-compose.yml
dest: .
- community.docker.docker_compose_v2:
project_src: "."
I haven't found anything except env_files attribute in your docs. I think the passing environments like docker compose run -e VAR
or something like this should help.
environment
sets environment variables while running modules, so this is equivalent to DATABASES_FOLDER=/ docker compose run ...
.
Right now there is no way to pass --env
to docker compose
, neither with the old nor with the new Docker compose module.