Docker安装ranhcer报错

环境信息:
RKE2 版本:

节点 CPU 架构,操作系统和版本:

Linux localhost 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux
集群配置:

问题描述:
我用docker安装rancher,然后就报错
*预期结果:
启动成功rancher

实际结果:
启动rancher失败

日志

INFO: Running k3s server --cluster-init --cluster-reset
2023/12/29 06:21:48 [INFO] Rancher version v2.7.9 (0c020f0c6) is starting
2023/12/29 06:21:48 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embedded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:false Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit.log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Features: ClusterRegistry:}
2023/12/29 06:21:48 [INFO] Listening on /tmp/log.sock
2023/12/29 06:21:48 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:21:50 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:21:52 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:21:54 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:21:56 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:21:58 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:22:00 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:22:02 [INFO] Waiting for server to become available: Get “https://127.0.0.1:6444/version?timeout=15m0s”: dial tcp 127.0.0.1:6444: connect: connection refused
2023/12/29 06:22:06 [FATAL] k3s exited with: exit status 2

首先,你可以参考 支持矩阵 来确认你的操作系统等是否支持对应版本的 rancher。

其次,rancher 容器启动失败了,最后报的 “k3s exited with: exit status 2”,这是因为 rancher 容器内部的 K3s 集群启动失败了,你可以 exec 到这个 rancher 容器内,然后查看 K3s 的日志,例如:docker exec -it e8c tail -200f k3s.log