docker安装
1.挂载并配置本地仓库
mount mount /dev/sr0 /mnt/
vi /etc/yum.repos.d/local.repo
[root@localhost ~]# cat /etc/yum.repos.d/local.repo
[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
enabled=1
gpgcheck=0
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
enabled=1
gpgcheck=0
[root@localhost ~]# dnf clean all
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
0 个文件已删除
[root@localhost ~]# dnf makecache
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
AppStream 93 MB/s | 6.5 MB 00:00
BaseOS 89 MB/s | 2.0 MB 00:00
上次元数据过期检查:0:00:01 前,执行于 2024年09月11日 星期三 09时35分51秒。
元数据缓存已建立。
2.进行docker的安装 docker-ce镜像_docker-ce下载地址_docker-ce安装教程-阿里巴巴开源镜像站 (aliyun.com)
yum install -y yum-utils device-mapper-persistent-data lvm2 1. 安装必要的一些系统工具
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
上次元数据过期检查:0:00:11 前,执行于 2024年09月11日 星期三 09时35分51秒。
软件包 device-mapper-persistent-data-1.0.6-3.el9_3.x86_64 已安装。
软件包 lvm2-9:2.03.21-3.el9.x86_64 已安装。
依赖关系解决。
=============================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================
安装:
yum-utils noarch 4.3.0-11.el9_3 BaseOS 45 k
事务概要
=============================================================================================
安装 1 软件包
总计:45 k
安装大小:23 k
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : yum-utils-4.3.0-11.el9_3.noarch 1/1
运行脚本: yum-utils-4.3.0-11.el9_3.noarch 1/1
验证 : yum-utils-4.3.0-11.el9_3.noarch 1/1
已更新安装的产品。
已安装:
yum-utils-4.3.0-11.el9_3.noarch
完毕!
Step 2: 添加软件源信息
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
添加仓库自:https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Step 3
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
Step 4: 更新并安装Docker-CE
yum -y install docker-ce
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
Docker CE Stable - x86_64 130 kB/s | 56 kB 00:00
上次元数据过期检查:0:00:01 前,执行于 2024年09月11日 星期三 09时37分25秒。
依赖关系解决。
=============================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================
安装:
docker-ce x86_64 3:27.2.1-1.el9 docker-ce-stable 27 M
安装依赖关系:
container-selinux noarch 3:2.221.0-1.el9 AppStream 60 k
containerd.io x86_64 1.7.21-3.1.el9 docker-ce-stable 43 M
docker-ce-cli x86_64 1:27.2.1-1.el9 docker-ce-stable 8.0 M
fuse-overlayfs x86_64 1.12-1.el9 AppStream 69 k
fuse3 x86_64 3.10.2-6.el9 AppStream 57 k
fuse3-libs x86_64 3.10.2-6.el9 AppStream 93 k
libslirp x86_64 4.4.0-7.el9 AppStream 72 k
slirp4netns x86_64 1.2.1-1.el9 AppStream 49 k
安装弱的依赖:
docker-buildx-plugin x86_64 0.16.2-1.el9 docker-ce-stable 14 M
docker-ce-rootless-extras x86_64 27.2.1-1.el9 docker-ce-stable 4.4 M
docker-compose-plugin x86_64 2.29.2-1.el9 docker-ce-stable 13 M
事务概要
=============================================================================================
安装 12 软件包
总计:109 M
总下载:109 M
安装大小:426 M
下载软件包:
(1/6): docker-buildx-plugin-0.16.2-1.el9.x86_64.rpm 823 kB/s | 14 MB 00:16
(2/6): docker-ce-cli-27.2.1-1.el9.x86_64.rpm 714 kB/s | 8.0 MB 00:11
(3/6): docker-ce-rootless-extras-27.2.1-1.el9.x86_64.rpm 741 kB/s | 4.4 MB 00:06
(4/6): docker-ce-27.2.1-1.el9.x86_64.rpm 782 kB/s | 27 MB 00:35
(5/6): docker-compose-plugin-2.29.2-1.el9.x86_64.rpm 1.1 MB/s | 13 MB 00:11
(6/6): containerd.io-1.7.21-3.1.el9.x86_64.rpm 924 kB/s | 43 MB 00:47
---------------------------------------------------------------------------------------------
总计 2.3 MB/s | 109 MB 00:47
Docker CE Stable - x86_64 15 kB/s | 1.6 kB 00:00
导入 GPG 公钥 0x621E9F35:
Userid: "Docker Release (CE rpm) <docker@docker.com>"
指纹: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
来自: https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
导入公钥成功
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : fuse3-libs-3.10.2-6.el9.x86_64 1/12
运行脚本: container-selinux-3:2.221.0-1.el9.noarch 2/12
安装 : container-selinux-3:2.221.0-1.el9.noarch 2/12
运行脚本: container-selinux-3:2.221.0-1.el9.noarch 2/12
安装 : docker-compose-plugin-2.29.2-1.el9.x86_64 3/12
运行脚本: docker-compose-plugin-2.29.2-1.el9.x86_64 3/12
安装 : containerd.io-1.7.21-3.1.el9.x86_64 4/12
运行脚本: containerd.io-1.7.21-3.1.el9.x86_64 4/12
安装 : fuse3-3.10.2-6.el9.x86_64 5/12
安装 : fuse-overlayfs-1.12-1.el9.x86_64 6/12
运行脚本: fuse-overlayfs-1.12-1.el9.x86_64 6/12
安装 : libslirp-4.4.0-7.el9.x86_64 7/12
安装 : slirp4netns-1.2.1-1.el9.x86_64 8/12
安装 : docker-buildx-plugin-0.16.2-1.el9.x86_64 9/12
运行脚本: docker-buildx-plugin-0.16.2-1.el9.x86_64 9/12
安装 : docker-ce-cli-1:27.2.1-1.el9.x86_64 10/12
运行脚本: docker-ce-cli-1:27.2.1-1.el9.x86_64 10/12
安装 : docker-ce-rootless-extras-27.2.1-1.el9.x86_64 11/12
运行脚本: docker-ce-rootless-extras-27.2.1-1.el9.x86_64 11/12
安装 : docker-ce-3:27.2.1-1.el9.x86_64 12/12
运行脚本: docker-ce-3:27.2.1-1.el9.x86_64 12/12
运行脚本: container-selinux-3:2.221.0-1.el9.noarch 12/12
运行脚本: docker-ce-3:27.2.1-1.el9.x86_64 12/12
验证 : containerd.io-1.7.21-3.1.el9.x86_64 1/12
验证 : docker-buildx-plugin-0.16.2-1.el9.x86_64 2/12
验证 : docker-ce-3:27.2.1-1.el9.x86_64 3/12
验证 : docker-ce-cli-1:27.2.1-1.el9.x86_64 4/12
验证 : docker-ce-rootless-extras-27.2.1-1.el9.x86_64 5/12
验证 : docker-compose-plugin-2.29.2-1.el9.x86_64 6/12
验证 : container-selinux-3:2.221.0-1.el9.noarch 7/12
验证 : fuse-overlayfs-1.12-1.el9.x86_64 8/12
验证 : fuse3-3.10.2-6.el9.x86_64 9/12
验证 : fuse3-libs-3.10.2-6.el9.x86_64 10/12
验证 : libslirp-4.4.0-7.el9.x86_64 11/12
验证 : slirp4netns-1.2.1-1.el9.x86_64 12/12
已更新安装的产品。
已安装:
container-selinux-3:2.221.0-1.el9.noarch containerd.io-1.7.21-3.1.el9.x86_64
docker-buildx-plugin-0.16.2-1.el9.x86_64 docker-ce-3:27.2.1-1.el9.x86_64
docker-ce-cli-1:27.2.1-1.el9.x86_64 docker-ce-rootless-extras-27.2.1-1.el9.x86_64
docker-compose-plugin-2.29.2-1.el9.x86_64 fuse-overlayfs-1.12-1.el9.x86_64
fuse3-3.10.2-6.el9.x86_64 fuse3-libs-3.10.2-6.el9.x86_64
libslirp-4.4.0-7.el9.x86_64 slirp4netns-1.2.1-1.el9.x86_64
完毕!
Step 5: 开启Docker服务
service docker start
Redirecting to /bin/systemctl start docker.service
Step 6 检查docker版本
docker version
Client: Docker Engine - Community
Version: 27.2.1
API version: 1.47
Go version: go1.22.7
Git commit: 9e34c9b
Built: Fri Sep 6 12:09:42 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 27.2.1
API version: 1.47 (minimum version 1.24)
Go version: go1.22.7
Git commit: 8b539b8
Built: Fri Sep 6 12:07:57 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.21
GitCommit: 472731909fa34bd7bc9c087e4c27943f9835f111
runc:
Version: 1.1.13
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
3.配置镜像加速器
3.1创建文件docker镜像的配置文件
mkdir -p /etc/docker
3.2 进入镜像文件 完成配置
vi /etc/docker/daemon.json
3.3重新加载docker服务的配置文件
systemctl daemon-reload
3.4重启dockerfuwu
systemctl restart docker
4.测试拉取镜像
拉取run
docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:53cc4d415d839c98be39331c948609b659ed725170ad2ca8eb36951288f81b75
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/
ur 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/