Skip to content

Create RequestScheme type to handle registry interactions#6

Merged
adityaramani merged 2 commits intomainfrom
users/a_ramani/local-registry
Jun 4, 2025
Merged

Create RequestScheme type to handle registry interactions#6
adityaramani merged 2 commits intomainfrom
users/a_ramani/local-registry

Conversation

@adityaramani
Copy link
Contributor

@adityaramani adityaramani commented Jun 4, 2025

Its a bit weird to have to pass --http when pulling / pushing images if we are trying to do so from a local registry

This PR adds a RequestScheme enum type which tries to detect if the connection to the registry should be over http or https. This auto detection is the default behavior and can be overridden by passing the --scheme http/https flag to the run ,pull, push login and registry default command

The auto detection works by looking at the hostname / IP. HTTP is used in the following cases

  • If the hostname starts with localhost or is 127.x.x.x
  • if the host looks like an IP from the private address space
  • If the host ends with the current default dns domain name

Also in this PR:

  • Removing some used CLI flag groups and TODOs
  • Better error messages when registry credentials are not found for a host

Signed-off-by: Aditya Ramani a_ramani@apple.com

@egernst
Copy link
Contributor

egernst commented Jun 4, 2025

@adityaramani - can we include the text you have in this PR in the commit itself? I feel like it'd be more useful to see it when reviewing git history (its a good writeup)

@adityaramani
Copy link
Contributor Author

@egernst Yes - thats the default behavior on merge. The PR title + description get added as part of the commit that goes to main

@egernst
Copy link
Contributor

egernst commented Jun 4, 2025

Ah, got it - great. Thanks Aditya.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing docc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@apple apple deleted a comment from jglogan Jun 4, 2025
@apple apple deleted a comment from jglogan Jun 4, 2025
@adityaramani adityaramani force-pushed the users/a_ramani/local-registry branch from 6ac025a to 3333f02 Compare June 4, 2025 20:52
Signed-off-by: Aditya Ramani <a_ramani@apple.com>
Signed-off-by: Aditya Ramani <a_ramani@apple.com>
@adityaramani adityaramani force-pushed the users/a_ramani/local-registry branch from 3333f02 to ea1d1b8 Compare June 4, 2025 20:55
@adityaramani adityaramani requested a review from jglogan June 4, 2025 20:56
@adityaramani adityaramani merged commit 85c9a5b into main Jun 4, 2025
1 check passed
@adityaramani adityaramani deleted the users/a_ramani/local-registry branch June 4, 2025 21:23
katiewasnothere pushed a commit that referenced this pull request Jun 5, 2025
Its a bit weird to have to pass `--http` when pulling / pushing images
if we are trying to do so from a local registry

This PR adds a `RequestScheme` enum type which tries to detect if the
connection to the registry should be over http or https. This auto
detection is the default behavior and can be overridden by passing the
`--scheme http/https` flag to the `run` ,`pull`, `push` `login` and
`registry default` command

The auto detection works by looking at the hostname / IP. HTTP is used
in the following cases
 - If the hostname starts with `localhost` or  is `127.x.x.x`
 - if the host looks like an IP from the private address space
 - If the host ends with the current default dns domain name

Also in this PR:
- Removing some used CLI flag groups and TODOs
- Better error messages when registry credentials are not found for a
host

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
owenarthur pushed a commit to owenarthur/container that referenced this pull request Jun 10, 2025
Its a bit weird to have to pass `--http` when pulling / pushing images
if we are trying to do so from a local registry

This PR adds a `RequestScheme` enum type which tries to detect if the
connection to the registry should be over http or https. This auto
detection is the default behavior and can be overridden by passing the
`--scheme http/https` flag to the `run` ,`pull`, `push` `login` and
`registry default` command

The auto detection works by looking at the hostname / IP. HTTP is used
in the following cases
 - If the hostname starts with `localhost` or  is `127.x.x.x`
 - if the host looks like an IP from the private address space
 - If the host ends with the current default dns domain name

Also in this PR:
- Removing some used CLI flag groups and TODOs
- Better error messages when registry credentials are not found for a
host

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
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

Successfully merging this pull request may close these issues.

4 participants