Skip to content

Support list style labels #431

Open
Open
@niwla23

Description

@niwla23
SUMMARY

Allow specifying labels as list like in docker-compose.

    - name: Create Traefik labels's dictionary
      ansible.builtin.set_fact:
        my_labels: "{{ my_labels | default({}) | combine ({ item.key : item.value }) }}"
      with_items:
        - { 'key': 'traefik.enable', 'value': 'true'}
        - { 'key': 'traefik.http.routers.{{ project_name }}.rule', 'value': 'Host(`{{ traefik_host }}`)'}
        - { 'key': 'traefik.http.routers.{{ project_name }}.tls.certresolver', 'value': 'le_main'}
        - { 'key': 'traefik.http.services.{{ project_name }}.loadbalancer.server.port', 'value': '80'}
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

community.docker.docker_container

ADDITIONAL INFORMATION

Allows to use templating in keys which is useful, e.g for traefik.

Example:
Currently this VERY ugly workaround has to be used:

    - name: Create app container
      community.docker.docker_container:
        name: "{{ project_name }}_app"
        image: "vaultwarden/server:1.25.1"
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.wekan.rule=Host(`{{ traefik_host }}`)"
          - "traefik.http.routers.wekan.entrypoints=web"
          - "traefik.http.routers.wekan.tls.certresolver=le_main"
          - "traefik.http.routers.wekan.entrypoints=websecure"

Metadata

Metadata

Assignees

No one assigned

    Labels

    docker-plainplain Docker (no swarm, no compose, no stack)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions