The problem looked like this:
[root@ci1 ~]# docker image pull wzkres/centos-ci-gcc:centos-7-cross-arm64
centos-7-cross-arm64: Pulling from wzkres/centos-ci-gcc
2d473b07cdd5: Already exists
9d26d6802cad: Pull complete
90f6d29b7c1a: Pull complete
7bfff1b24796: Pull complete
80b3d4546432: Pull complete
c3a37398e8b3: Pull complete
3ba42b3a770d: Pull complete
85b3405c69c4: Downloading
2ad9c2d42a3d: Waiting
5f1b06925eb4: Waiting
4f4fb700ef54: Waiting
57c257cf6173: Waiting
787f48d693d2: Waiting
9f1677804e77: Waiting
c13fd6dc43b4: Waiting
80bd40938514: Waiting
56ba96a89fa8: Waiting
unauthorized: authentication required
When pulling public images from hub.docker.com, this error occurred randomly but very frequently, making it almost impossible to download larger images. At first I thought it was a network issue, tried different proxies and mirrors, but nothing helped. Since the error mentioned 'authentication', I suspected Docker Hub login problems and tried docker login -u xxxx, but that did not solve it.
Later, while searching, I found a GitHub issue(https://github.com/docker/hub-feedback/issues/1484)where someone mentioned ‘clock-drift’. Checking the system time, I found it was about 5 minutes behind. Further inspection showed NTP was inactive (CentOS 8). So I executed:
[root@ci1 ~]# timedatectl set-ntp yes
[root@ci1 ~]# timedatectl
Local time: 四 2025-02-13 23:18:58 CST
Universal time: 四 2025-02-13 15:18:58 UTC
RTC time: 四 2025-02-13 15:18:58
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Now synchronized was yes and the system time corrected. After that, running docker pull no longer produced ‘authentication required’. Although the download was still a bit slow, it completed successfully. Recording this here for anyone facing the same issue.
博主友情提示:
如您在评论中需要提及如QQ号、电子邮件地址或其他隐私敏感信息,欢迎使用>>博主专用加密工具v3<<处理后发布,原文只有博主可以看到。