docker和docker-compose安装

  1. 卸载历史版本

#  卸载历史版本

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
  1. 安装docker

#  安装依赖
sudo yum install -y yum-utils

#   阿里云源: 
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

sudo yum install docker-ce docker-ce-cli containerd.io

#  镜像加速:您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/docker

sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["你的阿里云加速地址"]
}
EOF

sudo systemctl daemon-reload
sudo systemctl restart docker

  1. 安装docker-compose

curl -L https://get.daocloud.io/docker/compose/releases/download/1.26.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

  1. 添加权限

chmod +x /usr/local/bin/docker-compose

你可能感兴趣的:(docker和docker-compose安装)