Skip to content

hosts.toml file resolution does not seem to account for default port being ommitted #3047

Closed

Description

@apostasie

Description

nerdctl login https://foo:443
vs.
nerdctl login https://foo

If the hosts.toml path contains the port, the second one will fail.
On the other hand, if it does not, the first one will fail.

Responsibility for walking the host dir is in dockerconfigresolver.go (NewHostOptions > HostDir()).
This does not try to be smart wrt what the host contains (port or no port).

We should patch this so:

  • if scheme is https, passing :443 or not passing it should work
  • all of this should work with hosts.toml files path containing the port or not

Steps to reproduce the issue

See description

Describe the results you received and expected

Fail / not fail.

What version of nerdctl are you using?

1.7.6

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

Activity

  1. changed the title [-]hosts.toml file resolution does not account for default port being ommitted.Login against an https server with a custom certificate and default port will fail dependent on whether the port is specified and how the hosts.toml is configured [/-] [+]hosts.toml file resolution does not account for default port being ommitted.[/+] on May 31, 2024
  2. changed the title [-]hosts.toml file resolution does not account for default port being ommitted.[/-] [+]hosts.toml file resolution does not account for default port being ommitted[/+] on May 31, 2024
  3. changed the title [-]hosts.toml file resolution does not account for default port being ommitted[/-] [+]hosts.toml file resolution does not seem to account for default port being ommitted[/+] on May 31, 2024
  4. added
    bug
    and removed
    kind/unconfirmed-bug-claim
    on Jun 7, 2024
  5. Zheaoli commented on Jun 7, 2024

    @Zheaoli
    Member

    Seems we need rework the whole login and auth part = =

  6. apostasie commented on Jun 7, 2024

    @apostasie
    ContributorAuthor

    Seems we need rework the whole login and auth part = =

    Yes, that is what I am thinking.
    I am on it.
    Will start with revamping testing.

  7. djdongjin commented on Sep 10, 2024

    @djdongjin
    Member

    nerdctl login https://foo:443
    vs.
    nerdctl login https://foo

    What's the behavior in docker? e.g., if you docker login https://foo:443, can you docker pull an image from https://foo (and vice versa)?

  8. apostasie commented on Sep 10, 2024

    @apostasie
    ContributorAuthor

    nerdctl login https://foo:443
    vs.
    nerdctl login https://foo

    What's the behavior in docker? e.g., if you docker login https://foo:443, can you docker pull an image from https://foo (and vice versa)?

    Docker does not support hosts.toml, so, it does not seem like the above would matter here?

    Anyhow, here is a tentative proposal to clarify behavior wrt --insecure-registry, hosts.toml, and credentials:
    #3417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions