首页 > 系统相关 >centos 7.9 yum 安装最新版docker与dnf安装docker compose v2

centos 7.9 yum 安装最新版docker与dnf安装docker compose v2

时间:2022-10-03 15:46:32浏览次数:46  
标签:dnf ce compose yum docker 最新版 安装

centos 7.9 yum 安装最新版docker与dnf安装docker compose v2

一、环境查看

1、系统内核

#uname -r

2、系统版本

#cat /etc/redhat-release

二、更新yum源

1、备份旧yum仓库文件

#cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、进入yum源配置仓库所在目录

#cd /etc/yum.repos.d/

3、下载阿里云的yum源配置文件

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

4、清除旧缓存

#yum clean all

5、运行yum makecache生成缓存

#yum makecache

三、docker安装

1、卸载旧版本docker

#yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine

2、设置安装包----采用仓库安装

#yum install -y yum-utils

3、设置镜像仓库

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

4、快速更新yum源

#yum makecache fast

5、安装最新社区版docker引擎

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

注:如果不想安装最新版本可指定版本安装命令如下:

#yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

三、启动测试

1、启动docker

#systemctl start docker

2、查看docker版本信息

#docker version

3、运行hello-world测试docker

#docker run hello-world

4、查看docker下载的镜像文件

#docker images

四、docker的卸载

1、Uninstall the Docker Engine, CLI, and Containerd packages:

#yum remove docker-ce docker-ce-cli containerd.io

2、Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:

#rm -rf /var/lib/docker
#rm -rf /var/lib/containerd

五、安装docker compose

1、yum安装dnf

#yum -y install dnf

2、dnf检查docker compose相关插件

#dnf search docker-compose-plugin

3、dnf安装docker-compose-plugin

#dnf -y install docker-compose-plugin

4、检查docker compose命令

#docker compose version

标签:dnf,ce,compose,yum,docker,最新版,安装
From: https://www.cnblogs.com/niko-blog/p/16750473.html

相关文章