CentOS 安装Docker

Docker官网 Install Docker Engine on CentOS | Docker Docs

1.查看系统版本,Docker支持CentOS 7及以上版本

bash 复制代码
cat /etc/redhat-release

2.卸载旧版本

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

3.安装依赖

bash 复制代码
yum install -y gcc
yum install -y gcc c++
yum install -y yum-utils

4.设置阿里云镜像库

bash 复制代码
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

5.安装Docker CE

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

6.启动 Docker

bash 复制代码
systemctl start docker

7.验证安装

bash 复制代码
#查看版本
docker version    

docker run hello-world

bash 复制代码
docker run hello-world
相关推荐
Biomamba生信基地22 分钟前
Linux| 二.计算机软件组成与Linux
linux·运维·服务器·生信·医药
code_ing-29 分钟前
【Linux】命令行参数与环境变量
linux·c++·windows·笔记
j_xxx404_1 小时前
Linux:权限复盘扩展|粘滞位|软件包管理器|Linux软件生态
linux·1024程序员节
xflySnail2 小时前
内网穿透方案-nps
linux·服务器·内网穿透·nps
QiTinna2 小时前
Linux运维核心命令(入门)
linux·运维·服务器
JavaLearnerZGQ2 小时前
单机部署docker-nacos(通过下载nacos源码的方式)
运维·docker·容器
哦你看看3 小时前
Redis Sentinel哨兵集群
linux·redis·bootstrap·sentinel
草梅友仁4 小时前
RSS Impact 1.17.0 发布与 Docker 服务器迁移经验 | 2025 年第 44 周草梅周报
docker·开源·github
爱尔兰的楠小楠4 小时前
Windows上使用WSL2创建Ubuntu系统,实现无缝高效开发的体验
linux·windows·ubuntu
Fluency-114 小时前
ubuntu中ssh连接root用户
linux·ubuntu·ssh