Transfer: Registry: Enable plain HTTP
Currenlty transfer service doesn't handle plain HTTP connection. This commit fixes this issue by propagating `(core/remotes/docker/config).HostOptions.DefaultScheme` from client to the transfer service. This commit also fixes ctr to use this feature for "--plain-http" flag. Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
@@ -132,7 +132,11 @@ command. As part of this process, we do the following:
|
||||
sopts = append(sopts, image.WithAllMetadata)
|
||||
}
|
||||
|
||||
reg, err := registry.NewOCIRegistry(ctx, ref, registry.WithCredentials(ch), registry.WithHostDir(context.String("hosts-dir")))
|
||||
opts := []registry.Opt{registry.WithCredentials(ch), registry.WithHostDir(context.String("hosts-dir"))}
|
||||
if context.Bool("plain-http") {
|
||||
opts = append(opts, registry.WithDefaultScheme("http"))
|
||||
}
|
||||
reg, err := registry.NewOCIRegistry(ctx, ref, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -104,7 +104,11 @@ var pushCommand = &cli.Command{
|
||||
if local == "" {
|
||||
local = ref
|
||||
}
|
||||
reg, err := registry.NewOCIRegistry(ctx, ref, registry.WithCredentials(ch), registry.WithHostDir(context.String("hosts-dir")))
|
||||
opts := []registry.Opt{registry.WithCredentials(ch), registry.WithHostDir(context.String("hosts-dir"))}
|
||||
if context.Bool("plain-http") {
|
||||
opts = append(opts, registry.WithDefaultScheme("http"))
|
||||
}
|
||||
reg, err := registry.NewOCIRegistry(ctx, ref, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user