Skip to content

mod push tries to push to docker.io instead of localhost #516

@ineu

Description

@ineu

I started a registry locally (using https://zotregistry.dev) to test the mod push command. On my machine zot listens to 127.0.0.1:8080. So when I specify the port in the URL in timoni mod push, it works:

☸ xxx-k1 in work/timoni on  master [!+?] took 4s ❌1 ❯ timoni mod push . oci://localhost:8080/foo/bar --version=0.0.1
12:12PM INF artifact: oci://localhost:8080/foo/bar:0.0.1
12:12PM INF digest: sha256:947a6b95056abc01b9880104f7a3e5f5ffa19369273ec38978e4d046acafb2bb

But if I don't specify the port it fails to parse the URL and pushes to docker.io instead:

☸ xxx-k1 in work/timoni on  master [!+?] ❌1 ❯ timoni mod push . oci://localhost/foo/bar --version=0.0.1
12:11PM ERR pushing artifact failed: HEAD https://index.docker.io/v2/localhost/foo/bar/manifests/0.0.1: unexpected status code 401 Unauthorized (HEAD responses have no body, use GET for details)

If I use 127.0.0.1 without specifying the port it also works (i.e. connects to the localhost):

☸ xxx-k1 in work/timoni on  master [!+?] ❌130 ❯ timoni mod push . oci://127.0.0.1/foo/bar --version=0.0.1
12:20PM ERR pushing artifact failed: Get "https://127.0.0.1/v2/": dial tcp 127.0.0.1:443: connect: connection refused; Get "http://127.0.0.1/v2/": dial tcp 127.0.0.1:80: connect: connection refused

I suspect there's something wrong with the URL parsing logic. The docker.io fallback could make sense if a user specified a short name, like timoni mod push . foo/bar --version=0.0.1, but in the case above it's a proper full URL, not a shortcut, so the host must be parsed properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions