1.安装
[root@test04v ~]# docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
Unable to find image 'rancher/rancher:latest' locally
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
c2e3501e14c39f14c52c5f94bb75b42bd0a1490d387391dff137de724a2a9923
[root@test04v ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c2e3501e14c3 rancher/rancher "entrypoint.sh" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp fervent_euclid
注:如果不加--privilegedb会出现如下问题
[root@test04v ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9b7ce0332dfb rancher/rancher "entrypoint.sh" 2 minutes ago Restarting (1) 7 seconds ago happy_turing
[root@test04v ~]# docker logs 9b7ce0332dfb
ERROR: Rancher must be ran with the --privileged flag when running outside of Kubernetes
2.登录ranger
1). 在浏览器上登录http:${ranger_ip}
2).查看密码
[root@test04v ~]# docker logs c2e3501e14c3 2>&1 | grep "Bootstrap Password:"
2023/02/02 03:36:56 [INFO] Bootstrap Password: nztjhk9sgmnq9dtmslx59qfspvlvcwqn8bml2hslrwzfg742z9qbsc