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

ko is unable to push to a registry with a host and port number #93

Closed
scothis opened this issue Oct 1, 2019 · 5 comments · Fixed by #94 or #117
Closed

ko is unable to push to a registry with a host and port number #93

scothis opened this issue Oct 1, 2019 · 5 comments · Fixed by #94 or #117
Labels
help wanted Extra attention is needed

Comments

@scothis
Copy link

scothis commented Oct 1, 2019

When attempting to push images to a registry that uses a hostname and port (like registry.kube-system.svc.cluster.local:5000), ko fails with the following error:

2019/10/01 15:04:17 error creating publisher: failed to parse environment variable KO_DOCKER_REPO="registry.kube-system.svc.cluster.local:5000" as repository: repository can only contain the runes `abcdefghijklmnopqrstuvwxyz0123456789_-./`: registry.kube-system.svc.cluster.local:5000

A hostname and port is a valid registry and should be accepted by ko

@scothis
Copy link
Author

scothis commented Oct 1, 2019

The root of the issue is that ko treats the value of KO_DOCKER_REPO as a valid repository name. It is not a repository, but a base value to derive a repository name. Repositories that specify a host are also expected to include a path to disambiguate from library repositories.

A naive patch would be to append a fake path on the base before validating the repo base, however, this may cause issues with Docker Hub hosted repositories which may only contain a single slash.

scothis added a commit to projectriff/fats that referenced this issue Oct 1, 2019
jonjohnsonjr added a commit to jonjohnsonjr/ko that referenced this issue Oct 1, 2019
This allows you to use e.g. localhost:5000 as KO_DOCKER_REPO.

Fixes ko-build#93.
jonjohnsonjr added a commit that referenced this issue Oct 2, 2019
This allows you to use e.g. localhost:5000 as KO_DOCKER_REPO.

Fixes #93.
@scothis
Copy link
Author

scothis commented Oct 3, 2019

@jonjohnsonjr thanks for the quick turn around

@jonjohnsonjr
Copy link
Collaborator

You were the lucky third person to complain about this, so I decided maybe I'm the one that's wrong :P

cc @ian-mi this should be fixed now

@jonjohnsonjr
Copy link
Collaborator

jonjohnsonjr commented Dec 18, 2019

The fix for this broke dockerhub defaulting: #90 (comment)

Going to reopen this to track that. I think we can fix this by just re-ordering how we parse things.

Basically we just need to make sure:

  • DockerHub works with and without the docker.io prefix.
  • Using a bare domain works, e.g. running registry and setting KO_DOCKER_REPO=localhost:5000.

@jonjohnsonjr jonjohnsonjr reopened this Dec 18, 2019
@jonjohnsonjr jonjohnsonjr added the help wanted Extra attention is needed label Dec 18, 2019
@cezkuj
Copy link
Contributor

cezkuj commented Dec 18, 2019

I have got familiar with code looking on the other one. I will create PR for it, if you don't mind. Seems like re-ordering would do the trick, but will double check.

cezkuj added a commit to cezkuj/ko that referenced this issue Dec 18, 2019
Fixes ko-build#93

With this change we support also pointing to default registry (without prefix).
Eg. KO_DOCKER_REPO=myuser
jonjohnsonjr pushed a commit that referenced this issue Dec 18, 2019
Fixes #93

With this change we support also pointing to default registry (without prefix).
Eg. KO_DOCKER_REPO=myuser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
3 participants