clink icon indicating copy to clipboard operation
clink copied to clipboard

support for private registries

Open lindt opened this issue 8 years ago • 4 comments

currently just official images seem to be supported. public and private registry

ubuntu

works

but

foo/ubuntu

does not work, even if it would exist.

lindt avatar Mar 27 '16 12:03 lindt

It seems the command_not_found_handle hook isn't called if the command contains a /. A a given relative or absolute filename doesn't trigger a PATH search, and the hook function is only triggered when a PATH search returns no result. See also 3.7.2 Command Search and Execution.

It would be great to be able to do this, but I'm not sure how. As far as I know, neither bash aliases, commands or symlinks can contain slashes.

The closest hack I can think of would be to export the private registry namespace as an environment variable and then execute with it, like:

$ export jess="$HOME/bin"
$  ln -sf ~/git/clink/clink ~/bin/1995
$ $jess/1995

That's pretty whack, though.

soulshake avatar Mar 27 '16 20:03 soulshake

P.S. Regarding alpine, could you create a new issue? I think this is something different.

soulshake avatar Mar 27 '16 20:03 soulshake

yeah. pityful the cnf-handler does not help here. I also just can think of two workarounds.

1.) add a list of "trusted" Registries to search for.

plantuml --> cnf
--> searches dockerhub. no official image
--> searches env CLINK_REGISTRIES=think:soulshake:alpine  (should prob not separated by colons, then couldn't use private reg on registry:5000)
--> founds it as think/plantuml and invokes it with docker

This keeps commands short and also prevents from using "unsecure" images on accident.

2.) add some magic string replacement

instead of 'think/plantuml', I write 'think:plantuml'.
':' is converted into a '/' within clink.

This looks uglier than the first solution.

What's your opinion?

lindt avatar Mar 28 '16 14:03 lindt

+1 on CLINK_REGISTRIES, or CLINK_PATH or something like that.

I think the initial idea (when we brainstormed it with @soulshake) was to look for images in:

  • $USER/name
  • bin/name
  • name

I personally would vote for a semicolon-separated CLINK_REGISTRIES variable which would default to $USER;bin; - the final ; denoting an empty path component, meaning "official images".

So I could set it to, e.g.: localhost:5000;;bin which means that if I try to execute name it will try localhost:5000/name, name, and bin/name.

jpetazzo avatar Mar 28 '16 17:03 jpetazzo