centos 安装 docker

安装

1.安装所需软件包

复制代码
yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

2. 配置源地址

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

3.安装最新版本的dokcer

复制代码
yum -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin

4.如果需要安装特定版本,则列出并排序您存储库中可用的版本。此示例按版本号(从高到低)对结果进行排序。

复制代码
yum list docker-ce --showduplicates | sort -r

5.通过其完整的软件包名称安装特定版本,该软件包名称是软件包名称(docker-ce)加上版本字符串(第二列),从第一个冒号(:)一直到第一个连字符,并用连字符(-)分隔。例如:docker-ce-18.09.1。

复制代码
yum --y install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

6.启动 Docker服务

复制代码
systemctl start docker

7.通过运行 hello-world 镜像来验证是否正确安装了 Docker Engine-Community 。

复制代码
docker run hello-world

卸载 docker

删除安装包:

复制代码
yum remove docker-ce

删除镜像、容器、配置文件等内容:

复制代码
rm -rf /var/lib/docker
相关推荐
三言老师1 小时前
秘诀-如何远程SSN访问家里的八台电脑(frp 实操方案)
linux·运维·ssh
举手3 小时前
Dispatcher模块剖析
linux·c++
BTU_YC3 小时前
Docker Compose 部署 DozerDB 完整教程
运维·docker·容器
allforgood4 小时前
运行容器
linux
Light_It5 小时前
Linux 内核参数 pci-stub.ids=
linux·kernel
RisunJan5 小时前
Linux命令-scriptreplay(终端会话回放)
linux·运维·chrome
spencer_tseng6 小时前
[kylin & linux] install docker
linux·docker·kylin
x²+(y-√³x²)²=17 小时前
Linux打包文件到Windows,文件/文件类型丢失
linux·运维·windows
柒号华仔7 小时前
「速通Shell」聚砖成墙,Shell函数封装之道
linux·ssh·bash
airobotcn7 小时前
智能巡检平台容器化部署:Docker+K8s在工业边缘的实践
人工智能·docker·容器·kubernetes·机器人·自动化