Why is this refresh token request to auth.docker.io returning a 404? Why is this refresh token request to auth.docker.io returning a 404? docker docker

Why is this refresh token request to auth.docker.io returning a 404?


I was having the same problem. I'll put the solution first, with extra info later.

DOCKER_HUB_USERNAME=$1DOCKER_HUB_PASSWORD=$2DOCKER_REPO=$3AUTH_64=$(echo -n $DOCKER_HUB_USERNAME:$DOCKER_HUB_PASSWORD | base64)TOKEN=$(curl -s -H "Authorization: Basic $AUTH_64" \                -H 'Accept: application/json' \                "https://auth.docker.io/token?service=registry.docker.io&scope=repository:$DOCKER_REPO:pull" | jq -r .token)curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/json" \    "https://index.docker.io/v2/$DOCKER_REPO/tags/list" | jq -r .tags

I did some digging and found this answer which required you to use docker login, which isn't what I wanted. After looking into the docker conf file he was pulling from, I figured out the value was the base64 encoding of user:pass. So I just avoid trying to get a refresh token.

I used jq to get the json values. Here is a download link. You can retrieve them however you want. I placed the second command in as an example, although this should work with anything from the v2 API. I think you can even replace index.docker.io with any docker registry.

Oh, if you need push access be sure to change $DOCKER_REPO:pull to $DOCKER_REPO:pull,push