如果您不能使用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命令和其他可选配置步骤。文章来源:https://www.toymoban.com/news/detail-493329.html
[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文章来源地址https://www.toymoban.com/news/detail-493329.html
到了这里,关于Rpm安装Docker的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!