第一步,安裝docker(略)
第二步,下載rancher鏡像並運行
[root@VM-0-6-centos yum.repos.d]# docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable Unable to find image 'rancher/server:stable' locally stable: Pulling from rancher/server bae382666908: Pull complete 29ede3c02ff2: Pull complete da4e69f33106: Pull complete 8d43e5f5d27f: Pull complete b0de1abb17d6: Pull complete 422f47db4517: Pull complete 79d37de643ce: Pull complete 69d13e08a4fe: Pull complete 2ddfd3c6a2b7: Pull complete bc433fed3823: Pull complete b82e188df556: Pull complete dae2802428a4: Pull complete 07bf18e8eec0: Pull complete 339e24088f91: Pull complete 9372455de0b8: Pull complete 5a33b348bf45: Pull complete 3286997d8874: Pull complete bd79bfb954de: Pull complete ba7c19991a31: Pull complete 0c19aca4f8a1: Pull complete e03fc76c8997: Pull complete Digest: sha256:95b55603122c28baea4e8d94663aa34ad770bbc624a9ed6ef986fb3ea5224d91 Status: Downloaded newer image for rancher/server:stable 402053e52186fb2d924cd9d1644ab448f1f6dca20870236295e1aa1ebd2445f1 [root@VM-0-6-centos yum.repos.d]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 402053e52186 rancher/server:stable "/usr/bin/entry /usr…" 17 seconds ago Up 13 seconds 3306/tcp, 0.0.0.0:8080->8080/tcp beautiful_ride
第三步,打開瀏覽器
第四步,在各個節點上運行如下命令
[root@VM-0-4-centos ~]# sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.11 http://62.234.2.211:8080/v1/scripts/53CAE4F13CE51E688822:1577750400000:enfKXxe41rjZFnQXhGp8qVW5A INFO: Running Agent Registration Process, CATTLE_URL=http://62.234.2.211:8080/v1 INFO: Attempting to connect to: http://62.234.2.211:8080/v1 INFO: http://62.234.2.211:8080/v1 is accessible INFO: Configured Host Registration URL info: CATTLE_URL=http://62.234.2.211:8080/v1 ENV_URL=http://62.234.2.211:8080/v1 INFO: Inspecting host capabilities INFO: Boot2Docker: false INFO: Host writable: true INFO: Token: xxxxxxxx INFO: Running registration INFO: Printing Environment INFO: ENV: CATTLE_ACCESS_KEY=3C0911A398E75918079A INFO: ENV: CATTLE_HOME=/var/lib/cattle INFO: ENV: CATTLE_REGISTRATION_ACCESS_KEY=registrationToken INFO: ENV: CATTLE_REGISTRATION_SECRET_KEY=xxxxxxx INFO: ENV: CATTLE_SECRET_KEY=xxxxxxx INFO: ENV: CATTLE_URL=http://62.234.2.211:8080/v1 INFO: ENV: DETECTED_CATTLE_AGENT_IP=62.234.28.225 INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.11 INFO: Launched Rancher Agent: ae3340443f15d8563febb6c1c643d2d64cd6f6f3efb9746d80e3b8ca37ae1a52
可以看到如下