赞
踩
初始化系统安装常用工具:
yum -y install lrzsz vim wget net-tools bash-completion
初始化后可重启系统
准备:
查看防火墙和selinux是否开启
cat /etc/selinux/config
关闭selinux:
sed -i '/SELINUX/s/enforcing/disabled/g' /etc/selinux/config
关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld
开始安装docker:
安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
添加docker镜像软件源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
选择阿里云源快
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新yum包索引
yum makecache fast
安装docker-ce社区版
yum -y install docker-ce
启动
systemctl start docker
# 测试
docker run hello-world
docker version
配置镜像加速:
阿里云镜像加速:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://1do67ezy.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker
安装之前先查看你安装的docker的版本,对应安装相应版本的docker-compose
查看版本:
https://github.com/docker/compose/releases
#1.23.2
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
#1.28.4
curl -L "https://github.com/docker/compose/releases/download/1.28.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
参考链接:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。