运维开发网

docker自动部署脚本

运维开发网 https://www.qedev.com 2020-06-21 15:53 出处:网络 作者:运维开发网整理
#!/bin/bash #yangchen #uninstall for docker sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux

#!/bin/bash

#yangchen

#uninstall for docker

sudo yum remove docker \

docker-client \

docker-client-latest \

docker-common \

docker-latest \

docker-latest-logrotate \

docker-logrotate \

docker-seLinux \

docker-engine-seLinux \

docker-engine

#dependent to install

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

#download repo file

sudo yum-config-manager --add-repo

#install docker

sudo yum install -y docker-ce-18.06.1.ce-3.el7.x86_64

#configretion start for system

sudo systemctl enable docker

#enable ipv4 forward

echo ‘net.ipv4.ip_forward=1‘ >> /etc/sysctl.config && \

systemctl restart network

#config mirrors

if [ ! -d /etc/docker ];then

mkdir /etc/docker

fi

touch /etc/docker/daemon.json && \

sudo tee /etc/docker/daemon.json <<-‘EOF‘

{

"registry-mirrors": ["https://kzflpq4b.mirror.aliyuncs.com"],

"insecure-registries": ["http://192.168.2.196"]

}

EOF

#startup to dockersudo systemctl daemon-reload && \sudo systemctl restart docker

0

精彩评论

暂无评论...
验证码 换一张
取 消