Can't pull discourse base image because docker login was broken

AI-generated summary

User pfaffman encountered an error while trying to bootstrap a Discourse instance, receiving an “unauthorized: please use personal access token to login” message when pulling the discourse/base image. The issue persisted even after upgrading Docker to 19.03.8 and rebooting. Initial troubleshooting included checking Docker version, running docker ps, and testing with curl, all confirming authentication was unexpectedly required for a public repo. Falco suggested checking Docker’s config, while supermathie recommended running docker login. Following this advice, pfaffman generated a new personal access token from Docker Hub security settings, logged in via docker login --username pfaffman, and successfully resolved the issue. The cause of the sudden authentication requirement remains unclear, especially since the same setup worked two days prior. The fix restored normal operation of the multisite Discourse instance behind Caddy.

I just received this strange error trying to bootstrap.

I updated this site 2 days ago without incident.

root@support:/var/discourse# ./launcher bootstrap multi

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

Unable to find image 'discourse/base:2.0.20200429-2110' locally
/usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/discourse/base/manifests/2.0.20200429-2110: unauthorized: please use personal access token to login.
See '/usr/bin/docker run --help'.
Your Docker installation is not working correctly

See: https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam
root@support:/var/discourse# docker version
Client:
 Version:           18.09.6
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        481bc77
 Built:             Sat May  4 02:35:27 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.6
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       481bc77
  Built:            Sat May  4 01:59:36 2019
  OS/Arch:          linux/amd64
  Experimental:     false

root@support:/var/discourse# docker ps
CONTAINER ID        IMAGE                   COMMAND             CREATED             STATUS              PORTS                  NAMES
1e63a91934e8        local_discourse/multi   "/sbin/boot"        2 days ago          Up 2 days           0.0.0.0:7777->80/tcp   multi
8681e70a72a0        local_discourse/data    "/sbin/boot"        4 months ago        Up 3 weeks                                 data
root@support:/var/discourse# docker ps

It’s a multisite instance with Caddy as a reverse proxy, but a fairly standard install that’s been working for years.

What happens on a bare docker pull 'discourse/base:2.0.20200429-2110' ?

root@support:/var/discourse# docker pull 'discourse/base:2.0.20200429-2110'
Error response from daemon: Get https://registry-1.docker.io/v2/discourse/base/manifests/2.0.20200429-2110: unauthorized: please use personal access token to login
root@support:/var/discourse# 

also:

root@support:/var/discourse# curl https://registry-1.docker.io/v2/discourse/base/manifests/2.0.20200429-2110
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"discourse/base","Action":"pull"}]}]}
root@support:/var/discourse# 

Your local docker daemon is trying to auth to that repo. Check it config on the json file.

This seems like sage advice, but I don’t know how to act on it.

docker run -it --rm hello-world

fails similarly.

I just upgraded docker to 19.03.8 (was on 18.03 or so) and rebooted. The existing containers cranked back up.

I don’t have a clue what could have changed that would break this. I looked at /etc/docker/key.json and it looks very much like one that’s on another machine.

Googling: “docker unauthorized: please use personal access token to login for public repo” isn’t helping.

docker login might fix your problem.

You can also look at your ~/.docker/config.json to check which registries for which you have credentials - if you don’t need to login you can just remove them from that file.

That was it!

I went to docker settings/security, generated a new token and did a docker login --username pfaffman and pasted in the new key. I don’t know why the old one might have stopped working or why I’d need it all of a sudden. It was just two days ago that I did an upgrade without incident.

Thanks, Michael!