Skip to content

Conversation

buchdag
Copy link
Member

@buchdag buchdag commented Jun 8, 2025

This PR fixes #679

@buchdag buchdag self-assigned this Jun 8, 2025
@buchdag buchdag requested a review from Copilot June 8, 2025 16:18
Copilot

This comment was marked as resolved.

@buchdag
Copy link
Member Author

buchdag commented Jun 8, 2025

compose.yaml

services:
  app:
    scale: 22
    image: nginx:1.27-alpine
    labels:
      com.example.haproxy.backend: "true"

test.tmpl

{{ $containers := sortObjectsByKeysAsc (whereLabelValueMatches . "com.example.haproxy.backend" "true") "Labels.com.docker.compose.container-number" }}
{{ range $index, $container := $containers }}
{{ $index }} - {{ $container.Name }}: {{ index $container.Labels "com.docker.compose.container-number" }}
{{ end }}
docker-gen git:(fix/679) ✗ ./docker-gen wip/test.tmpl
0 - wip-app-1: 1
1 - wip-app-2: 2
2 - wip-app-3: 3
3 - wip-app-4: 4
4 - wip-app-5: 5
5 - wip-app-6: 6
6 - wip-app-7: 7
7 - wip-app-8: 8
8 - wip-app-9: 9
9 - wip-app-10: 10
10 - wip-app-11: 11
11 - wip-app-12: 12
12 - wip-app-13: 13
13 - wip-app-14: 14
14 - wip-app-15: 15
15 - wip-app-16: 16
16 - wip-app-17: 17
17 - wip-app-18: 18
18 - wip-app-19: 19
19 - wip-app-20: 20
20 - wip-app-21: 21
21 - wip-app-22: 22

@buchdag buchdag merged commit a92ca2e into main Jun 9, 2025
9 checks passed
@buchdag buchdag deleted the fix/679 branch June 9, 2025 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort containers by Labels.com.docker.compose.container-number
1 participant