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

Add labels to Docker images #726

Closed
SheevaPlug opened this issue Dec 27, 2023 · 1 comment · Fixed by #727
Closed

Add labels to Docker images #726

SheevaPlug opened this issue Dec 27, 2023 · 1 comment · Fixed by #727
Labels
docker-plain plain Docker (no swarm, no compose, no stack) enhancement New feature or request

Comments

@SheevaPlug
Copy link

SUMMARY

Add metadata (labels) to Docker images like "docker build --label ".

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

docker.community.docker_image

ADDITIONAL INFORMATION

Docker images can have labels to provide additional information for an image, for example to include the exact software version / branch / ... used for that build. The Docker cli can set image labels with the "--label" argument to "docker build". It would not only be an enhancement for some use cases, but also be consistent if docker_image supported this, as other modules in this collection like docker_container, docker_network and docker_volume already do.

- name: Build and push new image
  community.docker.docker_image:
    build:
      path: .
      labels:
        one: 1
        two: 2
    name: "{{ image_name }}"
    tag: "{{ image_tag }}"
    push: true
    source: build
@felixfontein
Copy link
Collaborator

#727 implements this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker-plain plain Docker (no swarm, no compose, no stack) enhancement New feature or request
Projects
None yet
2 participants