#安装必备的软件包:
yum -y install vim vim-enhanced net-tools wget lrzsz bash-completion sysstat unzip
# 关闭SElinux
setenforce 0
sed -i ‘s/^SELINUX=enforcing$/SELINUX=disabled/‘ /etc/selinux/config
#更新软件包
#yum -y update
#设置防火墙:
systemctl stop firewalld
systemctl disable firewalld
yum install iptables-services # 安装
systemctl restart iptables.service # 重启防火墙使配置生效
systemctl enable iptables.service # 设置防火墙开机启动
# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装 Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
#添加加速器地址到/etc/docker/daemon.json
sudo mkdir -p /home/docker
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF‘
{
"data-root":"/home/docker",
"registry-mirrors": ["https://x3j12ua3st.mirror.aliyuncs.com"],
"default-address-pools":[{"base":"172.16.0.0/12","size":24}],
"log-driver":"json-file",
"log-opts": {"max-size":"500m", "max-file":"3"}
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker
#vim /usr/lib/systemd/system/docker.service
#ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375
原文:https://blog.51cto.com/28917/2670792