I have service containers deployed in swarm-mode from images tagged with the registry host and port, e.g.: registry.local:5000/vote:v1. I want to display then using docker-swarm-visualizer for a demo but they appear incorrectly.
Expected image name: (Option 1) vote or (Option 2) registry.local:5000/vote
(Not too fussed which option)
Expected image tag: v1
Actual image name: registry.local
Actual image tag: 5000/vote
I was playing around to see how this could be done and found this regex works for Option 1:
let imageNameRegex = /([^/]+?)(\:([^/]+))?$/
The image name and tag can be retrieved like so:
let imageName = imageNameMatches[1]
let tagName = imageNameMatches[3]
This works for these possible combinations:
registry.local:5000/vote:v1
registry.local/vote:v1
registry.local/vote
vote:v1
vote
You might be able to think of a nicer regex.
I can submit a pull request if you think its a good idea.