CentOS yum安装docker和docker-compose

docker

#清理环境
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

#安装工具
sudo yum install -y yum-utils

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

#安装docker
sudo yum install -y docker-ce docker-ce-cli containerd.io

#启动docker & 设置开机启动
sudo systemctl start docker
sudo systemctl enable docker
docker version

docker-compose

#下载compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

#赋予执行权限
sudo chmod +x /usr/local/bin/docker-compose

#启动
docker-compose version

posted @ 2025-04-29 09:45  HookDing  阅读(108)  评论(0)    收藏  举报