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

Redhat OS安装docker-ce及docker-compose步骤

上官凯泽
2023-12-01

1、更换repo源

sudo yum install -y yum-utils
# 下面这两个视具体情况执行
# sudo yum install -y device-mapper-persistent-data lvm2
# sudo yum-config-manager --enable rhel-7-server-extras-rpms
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast

2、安装container-selinux包

sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-1.el7_6.noarch.rpm

3、安装docker-ce

sudo yum install docker-ce-18.06.3.ce-3.el7.x86_64
# 如果需要选择版本可以输入如下命令查看版本
# yum list docker-ce --showduplicates|sort -r
# yum install docker-ce-<version>-<release>

4、设置启动

sudo systemctl start docker
sudo systemctl enable docker

5、查看docker版本并测试

docker -v

#Test your Docker CE installation:
sudo docker run hello-world

6、安装docker-compose

sudo pip install docker-compose

如果pip也没有,那么先按照如下执行安装pip并更新python包

# install python-pip
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo yum install ./epel-release-latest-7.noarch.rpm
sudo yum install -y python-pip
# upgrade your Python packages:
sudo yum upgrade python*

参考文章:


1、如何在RHEL7上安装Docker CE 17.03?
2、RHEL 7 上安装 Docker CE

 类似资料: