Centos Docker 安装
2019-06-29 本文已影响0人
划破的天空
移除旧版本
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
安装依赖项
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
添加阿里云软件源
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新缓存
sudo yum makecache fast
安装Docker-ce
sudo yum -y install docker-ce
启动Docker
systemctl restart docker
Docker 添加国内镜像
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker-compose 安装
首先访问https://github.com/docker/compose/releases获取最新版本安装命令复制到shell
下载安装即可
curl -L https://github.com/docker/compose/releases/download/1.25.0-rc1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose