当前位置: 首页 > 工具软件 > Docker-Repo > 使用案例 >

RHEL8.4 安装docker&docker-compose

郑博厚
2023-12-01


rhel8.4 安装docker

sudo su
yum update

# yum源切换到阿里云,不然速度太慢还会超时

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

# 安装所需的软件包

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum install -y yum-utils device-mapper-persistent-data lvm2

# 下载docker软件源

curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
ls -l /etc/yum.repos.d/docker-ce.repo
yum clean all

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

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

# 启动docker

systemctl start docker
docker -v


rhel8.4 安装docker-compose
1. 下载docker-compose-linux-x86_64
https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-linux-x86_64

2. 下载好后,在rhel8.4中改名为docker-compose,并赋予可执行权限

mv docker-compose-linux-x86_64 docker-compose
chmod +x docker-compose


3. 将docker-compose文件拷贝到如下文件目录(找自己系统的,一般而言,rhel8.4在/usr/libexec/docker/cli-plugins):
        /usr/local/lib/docker/cli-plugins
        /usr/local/libexec/docker/cli-plugins
        /usr/lib/docker/cli-plugins
        /usr/libexec/docker/cli-plugins

cp docker-compose /usr/libexec/docker/cli-plugins


4. 此时不能直接使用docker-compose命令,需要将此文件拷贝到/usr/bin目录下

cp docker-compose /user/bin
docker-compose -v

 类似资料: