Skip to content

Pass envs to docker-compose #850

Open
@mihalt

Description

@mihalt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions