3.Centos-Docker-rancher
1.安装mysql,设置密码
docker run -d --name mysqldb -e MYSQL_ROOT_PASSWORD=密码 mysql:latest --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
2.配置mysql,要等一会才能连接上
docker run -it --link mysqldb:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"3306" -uroot -p"密码"'
CREATE DATABASE IF NOT EXISTS cattle COLLATE = 'utf8_general_ci' CHARACTER SET = 'utf8';
GRANT ALL ON cattle.* TO 'cattle'@'%' IDENTIFIED BY '密码';
GRANT ALL ON cattle.* TO 'cattle'@'localhost' IDENTIFIED BY '密码';
flush privileges;
3.安装rancher
#查看启动的mysqlid docker ps #查看到的id找ip docker inspect 8bf2e95111a5 | grep IP #安装rancher要等一会 docker run -d --name rancher-server --restart=unless-stopped -p 8081:8080 -p 9345:9345 rancher/server:stable \ --db-host mysqlip --db-port 3306 --db-user cattle --db-pass 密码 --db-name cattle \ --advertise-address 主机IP
#进入mysql
docker run -it --link mysqldb:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"3306" -uroot -p"fdsir7u34j2imds01asi"'
use cattle
show tables
#当查看到有92个表的时候就可以刷开网页了
http://主机IP:8081
#右下角设置中文
4.添加节点
#访问http://主机IP:8081/env/1a5/infra/hosts/add?driver=custom 查看添加节点的命令 sudo docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.0 http://主机IP:8081/v1/scripts/F86E1A7F8A1C98679790:1483142400000:TNxRCYGL79b0PmGUoy4NMMOemyc