docker安装脚本
#=================================
#scriptname:docker.sh
#author:Glory Ma
#founction:docker install script
#使用之前必须先配置好本地yum源
#=================================
#安装一些必要的系统工具:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install epel-release
yum install container-selinux
#添加软件源信息:
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#更新 yum 缓存:
yum makecache fast
yum -y install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.68-1.el7.noarch.rpm
#安装 Docker-ce:
yum -y install docker-ce
#启动 Docker 后台服务
systemctl enable docker && systemctl start docker
#配置加速器:
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh|sh -s http://1474c648.m.daocloud.io
cat /etc/docker/daemon.json
#使用registry-mirror选项
#修改:/etc/default/docker
cat <<EOF>/etc/default/docker
DOCKER_OPTS="-registry mirror=http://https://www.daocloud.io"
EOF
#重启docker服务
systemctl restart docker
#测试在线安装Java镜像:
docker search java
systemctl start docker.service
systemctl enable docker.service
#查看docker进程的状态
systemctl grep docker
systemctl disable firewalld
yum-y install iptables-services
systemctl enable iptables
systemctl start iptables