centos下使用阿里云镜像安装docker和docker-compose

环境:
OS:Centos 7

步骤1:

[root@localhost yum.repos.d]# yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed to connect to 2a05:d012:8b5:6503:9efb:5cad:348f:e826: Network is unreachable"

报错误:
解决办法:
mv CentOS-Base.repo CentOS-Base.repobak

 

步骤2:
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 

步骤3:
yum list docker-ce --showduplicates | sort -r

 

步骤4:
yum install -y docker-ce
报如此错误:

Error: Package: containerd.io-1.6.33-3.1.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2:2.74
Error: Package: docker-ce-rootless-extras-26.1.4-1.el7.x86_64 (docker-ce-stable)
           Requires: slirp4netns >= 0.4
Error: Package: 3:docker-ce-26.1.4-1.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2:2.74
Error: Package: docker-ce-rootless-extras-26.1.4-1.el7.x86_64 (docker-ce-stable)
           Requires: fuse-overlayfs >= 0.7

解决办法:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install epel-release -y
yum install container-selinux -y #安装最新的contain-selinux

 

再次安装
yum install -y docker-ce

 

步骤5:
启动
systemctl start docker
systemctl status docker

 

步骤6:
查看版本
docker version
docker -v

 

 

# 安装docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

也可以从其他机器下载的拷贝到服务器上

[root@host135 milvus]# docker-compose --version
docker-compose version 1.29.2, build 5becea4c

 

posted @ 2024-08-05 16:12  slnngk  阅读(593)  评论(0编辑  收藏  举报