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

Image and tag names not displayed correctly when registry host[:port] present #31

Closed
clarenceb opened this issue Oct 17, 2016 · 2 comments

Comments

@clarenceb
Copy link
Contributor

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.

@mortensteenrasmussen
Copy link

+1, I wanted to solve this myself, but I see you already made a PR. I'd love to see this merged @ManoMarks.

@ManoMarks
Copy link
Contributor

Merged

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

No branches or pull requests

3 participants