Docker 部署 Rancher v2.5 版本

Rancher v2.5 版本已经 EOL,特殊情况需要安装部署进行测试,可以通过 Docker 方式启动。

环境信息:

  • Docker: 20.10.13
  • Rancher: v2.5.17-ent5
  • Cgroup: v1

准备 Private Registry 认证的配置文件和 K3s 配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mkdir -pv /etc/rancher/k3s

cat <<EOF > /etc/rancher/k3s/registries.yaml
configs:
"harbor.warnerchen.com":
auth:
username: xxx
password: xxx
tls:
insecure_skip_verify: true
EOF

cat <<EOF > /etc/rancher/k3s/config.yaml
# 旧版本 K3s 似乎不支持使用该配置设置镜像仓库
# system-default-registry: harbor.warnerchen.com
debug: true
EOF

启动 Rancher:

1
2
3
4
5
6
7
8
9
10
11
12
13
docker run -d --restart=unless-stopped --name rancher \
-v /var/lib/rancher:/var/lib/rancher \
-v /etc/rancher/k3s/registries.yaml:/etc/rancher/k3s/registries.yaml:ro \
-v /etc/rancher/k3s/config.yaml:/etc/rancher/k3s/config.yaml:ro \
-e CATTLE_BOOTSTRAP_PASSWORD=xxx \
-e CATTLE_SYSTEM_DEFAULT_REGISTRY=harbor.warnerchen.com \
-e HTTP_PROXY="http://172.16.16.12:10808" \
-e HTTPS_PROXY="http://172.16.16.12:10808" \
-e NO_PROXY="localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,cattle-system.svc,172.16.16.0/24,.svc,.cluster.local,warnerchen.com" \
-p 80:80 \
-p 443:443 \
--privileged \
harbor.warnerchen.com/cnrancher/rancher:v2.5.17-ent5
Author

Warner Chen

Posted on

2025-11-25

Updated on

2025-11-26

Licensed under

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.