Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Need to support docker registries that store v1 and v2 images #221

Closed
stuart-warren opened this issue Oct 27, 2016 · 11 comments · Fixed by #222
Closed

Need to support docker registries that store v1 and v2 images #221

stuart-warren opened this issue Oct 27, 2016 · 11 comments · Fixed by #222
Labels

Comments

@stuart-warren
Copy link
Contributor

Some registries appear to store images that are only accessible via the same registry api version that they were pushed through.

for example:
docker2aci docker://gcr.io/google_containers/kubedns-amd64:1.7 # works!
docker2aci docker://gcr.io/google_containers/skydns:2015-10-13-8c72f8c # 404

Because the code currently assumes that a registry only supports one api version and v2 is checked first, if the registry supports v2 then any v1 images are not accessible.

@jonboulle
Copy link
Contributor

jonboulle commented Oct 27, 2016

@stuart-warren I think this is fixed via #214 - are you using master?

@stuart-warren
Copy link
Contributor Author

@jonboulle I'm pretty sure I am yes.
Does docker2aci docker://gcr.io/google_containers/skydns:2015-10-13-8c72f8c work for you with master?

@jonboulle
Copy link
Contributor

Nope, it does not :-(

@stuart-warren
Copy link
Contributor Author

Pretty sure the issue is this if statement:
https://github.com/appc/docker2aci/blob/master/lib/internal/backend/repository/repository.go#L88

    if supportsV2 {
        return rb.getImageInfoV2(dockerURL)
    } else {
        URLSchema, supportsV1, err := rb.supportsRegistry(dockerURL.IndexURL, registryV1)
        if err != nil {
            return nil, nil, err
        }
        if !supportsV1 {
            return nil, nil, fmt.Errorf("registry doesn't support API v2 nor v1")
        }
        rb.schema = URLSchema + "://"
        return rb.getImageInfoV1(dockerURL)
    }

Will propose a fix

@lucab
Copy link
Contributor

lucab commented Oct 27, 2016

I guess this is a part of #216.

@lucab
Copy link
Contributor

lucab commented Oct 27, 2016

/cc @dgonyeo @s-urbaniak

@stuart-warren
Copy link
Contributor Author

similar issues here:

if rb.hostsV2Support[dockerURL.IndexURL] {

@s-urbaniak
Copy link

It is a regression introduced in #220, as the above command works in 69aa7db.

@stuart-warren
Copy link
Contributor Author

stuart-warren commented Oct 27, 2016

@s-urbaniak agreed 😞 , however docker2aci was not correctly implementing the spec for v2 registries.
In seems that dockerhub and quay.io are a bit more helpful in their implementations and redirect clients from /v2 to /v2/

@lucab
Copy link
Contributor

lucab commented Oct 27, 2016

This is an unfortunate situation, but I think that #220 goes in the right direction and we should continue here. Current docker client behavior is to re-try with v1 if a v2 operation fails. As much as I don't like automatic protocol downgrades, it looks like we should implement this in order not to break registries not doing v1<->v2 mirroring.

In order to untangle this from the bigger scope of #216, I'd suggest to assume that current docker2aci mode is auto (ie. registry-v2,registry-v1) and implement this behavior as "probe v2, try v2, downgrade-on-failure, probe v1, try v1, hardfail-on-failure".

@stuart-warren we are a bit constrained at the moment, so unfortunately I don't think this would be tackled in the upcoming rkt release cycle. Would you be interested in addressing just this out of #216?

@stuart-warren
Copy link
Contributor Author

@lucab yeah I can give it a go.
Just to confirm, I'm to shuffle the code around to do the down grade automatically, but don't need to change the cli or any other tasks in that ticket?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants