Rpm安装Docker

如果您不能使用Docker的存储库来安装Docker,您可以下载.rpm文件并手动安装。每次要升级Docker引擎时,都需要下载一个新文件。

官方文档

1、登录https://download.docker.com/linux/centos/并选择您的CentOS版本。然后浏览到x86_64/stable/Packages/,下载您想要安装的Docker版本的.rpm文件

# 已 Centos 7.9为例
mkdir -p /data/docker
cd /data/docker/
wget -c -r -nd -np -k -L https://download.docker.com/linux/centos/7/x86_64/stable/

2、安装Docker引擎,将下面的路径改为下载Docker包的路径

[root@master ~]# rpm -ivh docker-ce-20.10.9-3.el7.x86_64.rpm
警告:docker-ce-20.10.9-3.el7.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 621e9f35: NOKEY
错误:依赖检测失败:
        container-selinux >= 2:2.74 被 docker-ce-3:20.10.9-3.el7.x86_64 需要
        containerd.io >= 1.4.1 被 docker-ce-3:20.10.9-3.el7.x86_64 需要
        docker-ce-cli 被 docker-ce-3:20.10.9-3.el7.x86_64 需要
        docker-ce-rootless-extras 被 docker-ce-3:20.10.9-3.el7.x86_64 需要

# 使用yum自动解决依赖
yum -y localinstall containerd.io-1.5.10-3.1.el7.x86_64.rpm docker-ce-cli-20.10.9-3.el7.x86_64.rpm docker-scan-plugin-0.9.0-3.el7.x86_64.rpm docker-ce-rootless-extras-20.10.9-3.el7.x86_64.rpm docker-ce-20.10.9-3.el7.x86_64.rpm

Docker已安装但未启动。这docker创建了组,但没有用户添加到组中。

3、配置加速器并启动Docker

cat >/etc/docker/daemon.json <<EOF
{
  "registry-mirrors": [
    "https://dockerhub.azk8s.cn",
    "https://docker.mirrors.ustc.edu.cn",
    "https://registry.docker-cn.com"
  ]
}
EOF
systemctl start docker && systemctl enable --now docker

4、通过运行hello-world镜像来验证Docker引擎是否正确安装。
这将安装和运行Docker引擎。使用sudo运行Docker命令。继续执行Linux的安装后步骤,以允许非特权用户运行Docker命令和其他可选配置步骤。

[root@master ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:62af9efd515a25f84961b70f973a798d2eca956b1b2b026d0a4a63a3b0b6a3f2
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Keep your face to the sun so you don’t see shadows

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

星光落入你灰蒙蒙的眼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值