https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/deployment/quickstart-manual-setup/
Install Rancher
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:stable
docker run -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
-v //:/etc/rancher/ssl/cert.pem \
-v //:/etc/rancher/ssl/key.pem \
/rancher/rancher: --no-cacerts
参考 CentOS 7 下 yum 安装 Docker CE
根据自己实际需要安装,这是我之前制作docker镜像时用于传输一些配置文件用的,一起记录下来了而已。
sudo docker run -d -p 20-21:20-21 -p 21100-21110:21100-21110 -e FTP_PASS=123 -v /home/anrj/upload:/home/vsftpd --name vsftpd fauria/vsftpd
创建一个docker组
sudo groupadd docker
添加当前用户到docker组
sudo usermod -aG docker $USER
登出,重新登录shell
docker run -d --restart=unless-stopped \
-p 8080:80 -p 4433:443 \
-v /opt/rancher:/var/lib/rancher \
-v /var/log/rancher/auditlog:/var/log/auditlog \
-v /home/anrj/ssl/cert.pem:/etc/rancher/ssl/cert.pem \
-v /home/anrj/ssl/key.pem:/etc/rancher/ssl/key.pem \
-e AUDIT_LEVEL=3 \
--name rancher_stable \
rancher/rancher:stable --no-cacerts;
无实际作用,仅个人使用,记录而已!
registry:latest
5000
/home/anrj/docker/data/registry
/var/lib/registry
27017
MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=123456
/home/anrj/docker/data/mongo/data
/data/db
mysql:latest
3306
MYSQL_ROOT_PASSWORD = 123456
/home/anrj/docker/data/mysql
/var/lib/mysql
redis
6379
/home/anrj/docker/data/redis/
/data
127.0.0.1:50/jrebel_reverse_proxy
8888
127.0.0.1:50/vz-earlyup:latest
9099
sudo vim /etc/docker/daemon.json
sudo systemctl daemon-reload
sudo service docker restart
but IDEA里操作还是推送失败! ♂️
还是直接命令操作吧
ok push 成功! [IP]:[Port]/v2/_catalog
rancher_reload.sh
注意:此脚本会把所有的docker镜像给删除!
#!/bin/sh
echo "重装Rancher"
sudo docker rm -f $(sudo docker ps -qa)
sudo docker rmi -f $(sudo docker images -q)
sudo docker volume rm $(sudo docker volume ls -q)
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
sudo rm -rf /opt/rancher /var/log/rancher/auditlog /etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico
iptables -F && iptables -t nat -F
ip link del flannel.1
ip link del tunl0
sudo systemctl daemon-reload
sudo systemctl restart docker
echo "清理完毕~"
echo ""
echo "开始安装..."
docker run -d --restart=unless-stopped \
-p 8080:80 -p 4433:443 \
-v /opt/rancher:/var/lib/rancher \
-v /var/log/rancher/auditlog:/var/log/auditlog \
-v /home/anrj/ssl/cert.pem:/etc/rancher/ssl/cert.pem \
-v /home/anrj/ssl/key.pem:/etc/rancher/ssl/key.pem \
-e AUDIT_LEVEL=3 \
--name rancher_stable \
rancher/rancher:stable --no-cacerts;
echo "重装完毕~"
curl https://raw.githubusercontent.com/burnettk/delete-docker-registry-image/master/delete_docker_registry_image.py | sudo tee /usr/local/bin/delete_docker_registry_image >/dev/null
sudo chmod a+x /usr/local/bin/delete_docker_registry_image
参考 https://segmentfault.com/a/1190000011153919
折腾吧!不行就推到重来,毕竟上面两个脚本就是为折腾而生的~