docker-archive / migrator

Tool to migrate Docker images from Docker Hub or v1 registry to a v2 registry
Apache License 2.0
160 stars 82 forks source link

Namespaces returns owners only, not read access #93

Closed Brett55 closed 7 years ago

Brett55 commented 7 years ago

When doing a GET on https://hub.docker.com/v2/repositories/namespaces it returns only namespaces in which members are owners, rather than read access. Thus causing this code block to raise an exception incorrectly

https://github.com/docker/migrator/blob/master/migrator.sh#L430-L436

mbentley commented 7 years ago

Ah crap, you're right. I'll have to see what API I might have access to to check what organizations a user has any access to. In the meantime, I'll put in a PR to bypass the check as you're definitely right.

Brett55 commented 7 years ago

Thanks for quick response!

mbentley commented 7 years ago

Apparently this should return what orgs a user belongs to: https://hub.docker.com/v2/user/orgs/

mbentley commented 7 years ago

Looks like this will fix it...change https://github.com/docker/migrator/blob/master/migrator.sh#L431 to: NAMESPACES=$(curl -sf -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/user/orgs/ | jq -r '.results|.[].orgname') || catch_error "curl => API failure"

Brett55 commented 7 years ago

@mbentley looks good, thanks for quick fix