为什么使用 rancher/rancher:latest 启动 rancher 不是最新版

微信群反馈:
使用 rancher/rancher:latest 镜像启动单节点 rancher,启动的 rancher 版本为 v2.6.3,并不是最新的 v2.6.8

经过排查,这是因为用户配置了 mirror 导致,使用我个人的阿里云 mirror 即可重现:

root@demo-1:~# docker pull rancher/rancher
Using default tag: latest
latest: Pulling from rancher/rancher
a3009803982d: Pull complete
cf9e817c5d35: Pull complete
b380663f8ccc: Pull complete
1ca0e2238656: Pull complete
65086cb458c9: Pull complete
c6d25608690f: Pull complete
6c8ad6da7ce2: Pull complete
6a6940e66f68: Pull complete
b115b1ef2b5b: Pull complete
b4b03dbaa949: Pull complete
aef7deb59b77: Pull complete
0bbf7579a568: Pull complete
eaa5d6336f95: Pull complete
608f536609b9: Pull complete
fcaf65f7937c: Pull complete
e4ea550002d9: Pull complete
9d698b9289d2: Pull complete
caa4144aedf1: Pull complete
Digest: sha256:f411ee37efa38d7891c11ecdd5c60ca73eb03dcd32296678af808f6b4ecccfff
Status: Downloaded newer image for rancher/rancher:latest
docker.io/rancher/rancher:latest
root@demo-1:~# docker run -itd -p 80:80 -p 443:443 --privileged rancher/rancher
b6dd9fc649eab332b2879b979e1edea5b683ffef34240f5837f51e8c39ec4d9c
root@demo-1:~# docker exec -it b6dd9 bash
b6dd9fc649ea:/var/lib/rancher # rancher -v
rancher version v2.6.3 (3c1d5fac3)

原因

经过排查,是因为 配置了 mirror 导致的,因为某种原因,mirror 里缓存的 rancher/rancher:latest 版本是 v2.6.3,为了解决这个问题,可以替换为其他 mirror,例如:https://docker.mirrors.ustc.edu.cn,或者取消 mirror 的配置。

更好的办法是指定对应的 rancher 版本