Dist-Zilla-Plugin-Docker-API

 view release on metacpan or  search on metacpan

lib/Dist/Zilla/Plugin/Docker/API/Client.pm  view on Meta::CPAN

    my $registry = $self->_registry_for_image_ref($image_ref);
    return $self->_auth_for_registry($registry);
}

sub _registry_for_image_ref {
    my ($self, $image_ref) = @_;

    # Strip ":tag" or "@sha256:..." suffix from the image part.
    my $name = $image_ref;
    $name =~ s/\@sha256:.*$//;
    my @parts = split m{/}, $name;

    # If the first component does NOT look like a registry host
    # (no dot, no colon, not "localhost"), it's an implicit Docker Hub repo.
    if (@parts < 2 || ($parts[0] !~ /[.:]/ && $parts[0] ne 'localhost')) {
        return 'https://index.docker.io/v1/';
    }
    return $parts[0];
}

sub _auth_for_registry {



( run in 1.360 second using v1.01-cache-2.11-cpan-71847e10f99 )