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

Pass envs to docker-compose #850

Open
mihalt opened this issue May 9, 2024 · 1 comment
Open

Pass envs to docker-compose #850

mihalt opened this issue May 9, 2024 · 1 comment
Labels
docker-compose-v2 Docker Compose v2 enhancement New feature or request

Comments

@mihalt
Copy link

mihalt commented May 9, 2024

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.

@felixfontein
Copy link
Collaborator

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.

@felixfontein felixfontein added enhancement New feature or request docker-compose-v2 Docker Compose v2 labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker-compose-v2 Docker Compose v2 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants