Get "https://registry-1.docker.io/v2/": connection refused on every first login attempt

I have read other topics discussing similar errors and I think what I got is significantly different.
I use pass cred storage and docker-credential-pass to login to docker. The setup seems to work fine, except for logins. Each time I try to log into docker using docker login, I get a prompt from pass, meaning that docker pulls my credentials from local encrypted storage. However, then this happens:

$> docker login
# here I let pass return my creds to docker, successfully...
Authenticating with existing credentials...
Login did not succeed, error: Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:52417->[::1]:53: read: connection refused
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username (username): username
Password: # here I enter the password manually
Login Succeeded

So my login request to registry-1.docker.io is provided with creds from pass, but still fails. Then docker requests my credentials again, and the second time the request succeeds. Mind you, the credentials written to local storage do not change as a result of this.

A similar thing happens when I login to docker anew, without creds in local storage:

$> docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: username
Password: 
Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:41454->[::1]:53: read: connection refused
$> docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: username
Password: 
Login Succeeded

First request fails, without indicating that creds were wrong (they were not). The second request gets through with the same inputs.

This seems to be either an error on docker.io side or a local misconfiguration. Is there anything I can do to login on first try?
Thanks.