Linux安装Docker

安装docker

1、安装依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 
2、设置阿里云镜像源
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3、安装 Docker-CE
sudo yum -y install docker-ce

启动docker

# 开机自启
sudo systemctl enable docker 
# 启动docker服务  
sudo systemctl start docker

安装docker-compose

# 下载docker compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 添加可执行权限
sudo chmod +x /usr/local/bin/docker-compose
# 将文件copy到 /usr/bin/目录下
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 查看版本
docker-compose --version

你可能感兴趣的:(Linux安装Docker)