sergi0g / cup

🥤Docker container updates made easy
https://sergi0g.github.io/cup/docs
GNU Affero General Public License v3.0
130 stars 1 forks source link

Failed to authenticate to registry #18

Closed lukasMega closed 1 week ago

lukasMega commented 3 months ago
...nPEi_nESiKrpUa8Gof1s-Hzzz22MEfGA3acSXO9177U7m-uPVZWHrceBEzesjAiedYvu3e26LJ7rCanNPVegVjI886qgmAaP_FGnxi_lz2sUObjPFXQhN78dZbM8cLNg8dgn1__G2j3LJngm5kebmjXdCh_jQrHFMhG45bjpui-GA

Failed to authenticate to registry nabo.codimd.dev with given token!

when i added https://github.com/hackmdio/codimd/blob/develop/deployments/docker-compose.yml I'm getting this error and Cup is unavailable

sergi0g commented 3 months ago

Hello @lukasMega! Sorry for this issue. To help debug, can you please run Cup again and provide the full token from the output?

sergi0g commented 3 months ago

Hi again! I can reproduce your issue. I'm not sure what goes wrong here, so I'll have to manually try to reproduce. However, nabo.codimd.dev just redirects to docker hub, so as a temporary workaround just change the image you're pulling to hackmdio/hackmd:2.5.3. Finally, please remember to delete the old image with docker rmi nabo.codimd.dev/hackmdio/hackmd:2.5.3 so Cup doesn't give you any more errors.

lukasMega commented 3 months ago

Thank you. It will be closed or do you consider to handle such case? It would be great.

sergi0g commented 3 months ago

I will not close this issue. I need to find the problem because this might affect other registries too.

sergi0g commented 1 month ago

It seems docker.getoutline.com has the same issue.

ritzdan commented 4 weeks ago

Same issue with self-hosted gitea with the following stdout:

â ‹ Checking...                                                                   
â ™ Checking...                                                                   
â ¹ Checking...                                                                   
â ¸ Checking...                                                                   
â ¼ Checking...                                                                   
â ´ Checking...                                                                   
â ¦ Checking...                                                                   
â § Checking...                                                                   
â ‡ Checking...                                                                   
â ‹ Checking...                                                                   
â ™ Checking...                                                                   
â ¹ Checking...                                                                   
â ¸ Checking...                                                                   
 WARN  
 Failed to authenticate to registry git.tools.cloudfor.ge with given token!
{token string removed, not sure if it is sensitive}
â ¼ Checking...                                                                   
â ´ Checking...                                                                   
â ¦ Checking...                                                                   
â § Checking...                                                                   
â ‡ Checking...                                                                   
â ‹ Checking...                                                                   
â ™ Checking...                                                                   
â ¹ Checking...                                                                   
â ¸ Checking...                                                                   
â ¼ Checking...                                                                   
â ´ Checking...                                                                   
â ¦ Checking...                                                                   
â § Checking...                                                                   
â ‡ Checking...                                                                   
â ‹ Checking...                                                                   
â ™ Checking...                                                                   
â ¹ Checking...                                                                   
â ¸ Checking...                                                                   
â ¼ Checking...                                                                   
â ´ Checking...                                                                   
â ¦ Checking...                                                                   
â § Checking...                                                                   
â ‡ Checking...                                                                   
â ‹ Checking...                                                                   
â ™ Checking...                                                                   
â ¹ Checking...                                                                   
â ¸ Checking...                                                                   
â ¼ Checking...                                                                   

✓
 Done!
thread 'main' panicked at library/alloc/src/raw_vec.rs:25:5:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
sergi0g commented 4 weeks ago

@ritzdan have you configured authentication for your self hosted registry in the config.json?

ritzdan commented 4 weeks ago

Sorry, should have included the following. I am using the same access token as I use for docker login to pull the image.

/tmp/config.json:

{
    "authentication": {
        "gitea.xxxxx.xxx": "xxxxxxxxxxx"
    }
}

command:

docker run \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /tmp/config.json:/config/cup.json \
    -t ghcr.io/sergi0g/cup check -i
sergi0g commented 3 weeks ago

@ritzdan sorry for not replying! I will test with my local Gitea instance ASAP and I'll get back to you. Last time I tested it worked fine, so I'm thinking this whole issue might be related to the reverse proxy used. I still need to gather more info though.

sergi0g commented 3 weeks ago

Hey again @ritzdan! I tested with my local Gitea instance and it worked fine, so I thought the problem was probably on your end.

It turns out that you forgot to pass the configuration to the command. Here it is corrected:

docker run \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /tmp/config.json:/config/cup.json \
    -t ghcr.io/sergi0g/cup -c /config/cup.json check -i

It's mentioned in the docs here.

johnnyggalt commented 2 weeks ago

After updating to latest build (not sure if that triggered the issue), I am getting this:

WARN  Failed to authenticate to registry registry-1.docker.io with given token!

Is there a way to remove the cached token? Might be nice to include that in the message.

sergi0g commented 1 week ago

I debugged this properly and it seems that the only thing Docker CLI is doing different is using the URL the registry redirects to as the registry and makes all subsequent requests there. Fixing the problem would require significant code changes that would change the way Cup works. Since this problem affects very few users, I will close this issue.