centos7安装docker容器

卸载老版本:

bash 复制代码
$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

/var/lib/docker/路径下存在镜像、数据卷、容器等,在卸载的时候是不会自动删除的。

安装yum源

bash 复制代码
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

安装最新版本:

bash 复制代码
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

安装指定版本:

搜索版本:

bash 复制代码
yum list docker-ce --showduplicates | sort -r
bash 复制代码
docker-ce.x86_64    3:24.0.0-1.el8    docker-ce-stable
docker-ce.x86_64    3:23.0.6-1.el8    docker-ce-stable
<...>

安装:

<VERSION_STRING>替换为对应的版本号

bash 复制代码
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin

启动docker :

bash 复制代码
sudo systemctl start docker

设置开机启动:

bash 复制代码
systemctl enable docker

测试:

bash 复制代码
sudo docker run hello-world
相关推荐
超龄超能程序猿18 分钟前
Docker常用中间件部署笔记:MongoDB、Redis、MySQL、Tomcat快速搭建
笔记·docker·中间件
奔波霸的伶俐虫22 分钟前
windows docker desktop 安装修改镜像学习
学习·docker·容器
原神启动125 分钟前
K8S(六)—— 企业级,Rancher安装配置与核心功能实操
容器·kubernetes·rancher
阿杰 AJie26 分钟前
安装 docker.io(不走外网 Docker 域名)
docker·容器·eureka
.hopeful.36 分钟前
Docker——镜像仓库和镜像
运维·docker·容器
m0_4856146741 分钟前
K8S项目生命周期管理
云原生·容器·kubernetes
CodeCaptain1 小时前
Dify结合vllm-openai docker镜像出现docker: invalid reference format问题的解决方案
运维·docker·容器
LucidX1 小时前
Kubernetes Pod 详解与Rancher 部署
容器·kubernetes·rancher
星环处相逢1 小时前
从 Pod 核心原理到 Rancher 实战:K8s 容器管理全解析
容器·kubernetes·rancher
伞啊伞1 小时前
k8s(四) Rancher 管理集群
容器·kubernetes·rancher