docker的离线安装方法和网络源安装方法

《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》点击传送门,即可获取!

清除缓存并查看源是否更新


  • yum clean all : 清除缓存

  • yum repolist : 查看yum数量

[root@ccx yum.repos.d]# yum clean all

Loaded plugins: fastestmirror, langpacks

Cleaning repos: base docker-ce-stable epel extras kubernetes updates

Cleaning up list of fastest mirrors

[root@ccx yum.repos.d]# yum repolist

Loaded plugins: fastestmirror, langpacks

Determining fastest mirrors

base | 3.6 kB 00:00:00

docker-ce-stable | 3.5 kB 00:00:00

epel | 4.7 kB 00:00:00

extras | 2.9 kB 00:00:00

kubernetes/signature | 844 B 00:00:00

kubernetes/signature | 1.4 kB 00:00:00 !!!

updates | 2.9 kB 00:00:00

(1/10): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:00

(2/10): epel/x86_64/group_gz | 96 kB 00:00:00

(3/10): docker-ce-stable/x86_64/primary_db | 62 kB 00:00:00

(4/10): base/7/x86_64/group_gz | 153 kB 00:00:00

(5/10): extras/7/x86_64/primary_db | 242 kB 00:00:00

(6/10): kubernetes/primary | 90 kB 00:00:00

(7/10): epel/x86_64/updateinfo | 1.0 MB 00:00:00

(8/10): base/7/x86_64/primary_db | 6.1 MB 00:00:04

(9/10): epel/x86_64/primary_db | 6.9 MB 00:00:05

(10/10): updates/7/x86_64/primary_db | 8.8 MB 00:00:06

kubernetes 666/666

repo id repo name status

base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072

docker-ce-stable/x86_64 Docker CE Stable - x86_64 117

epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,608

extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 498

kubernetes Kubernetes 666

updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 2,437

repolist: 27,398

安装docker并启动服务


  • yum -y install docker-ce : 安装docker服务【一共有9个包】

  • systemctl enable docker --now:开机自启并现在启动

  • docker info # 查看详细信息

[root@ccx yum.repos.d]# yum -y install docker-ce

Loaded plugins: fastestmirror, langpacks

Determining fastest mirrors

base | 3.6 kB 00:00:00

docker-ce-stable | 3.5 kB 00:00:00

epel | 4.7 kB 00:00:00

extras | 2.9 kB 00:00:00

kubernetes/signature | 844 B 00:00:00

Retrieving key from https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg

Importing GPG key 0x307EA071:

Userid : “Rapture Automatic Signing Key (cloud-rapture-signing-key-2021-03-01-08_01_09.pub)”

Fingerprint: 7f92 e05b 3109 3bef 5a3c 2d38 feea 9169 307e a071

From : https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg

Retrieving key from https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

kubernetes/signature | 1.4 kB 00:00:00 !!!

updates | 2.9 kB 00:00:00

(1/10): epel/x86_64/group_gz | 96 kB 00:00:00

(2/10): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:00

(3/10): docker-ce-stable/x86_64/primary_db | 62 kB 00:00:00

(4/10): base/7/x86_64/group_gz | 153 kB 00:00:00

(5/10): epel/x86_64/updateinfo | 1.0 MB 00:00:00

(6/10): kubernetes/primary | 92 kB 00:00:00

(7/10): extras/7/x86_64/primary_db | 242 kB 00:00:00

(8/10): base/7/x86_64/primary_db | 6.1 MB 00:00:01

(9/10): epel/x86_64/primary_db | 6.9 MB 00:00:02

(10/10): updates/7/x86_64/primary_db | 8.8 MB 00:00:02

kubernetes 678/678

Resolving Dependencies

–> Running transaction check

—> Package docker-ce.x86_64 3:20.10.7-3.el7 will be installed

–> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Processing Dependency: containerd.io >= 1.4.1 for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Processing Dependency: docker-ce-cli for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Running transaction check

—> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed

—> Package containerd.io.x86_64 0:1.4.6-3.1.el7 will be installed

—> Package docker-ce-cli.x86_64 1:20.10.7-3.el7 will be installed

–> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.7-3.el7.x86_64

—> Package docker-ce-rootless-extras.x86_64 0:20.10.7-3.el7 will be installed

–> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64

–> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64

–> Running transaction check

—> Package docker-scan-plugin.x86_64 0:0.8.0-3.el7 will be installed

—> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed

–> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64

–> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64

–> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64

—> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed

–> Running transaction check

—> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================

Package Arch Version Repository Size

======================================================================================================

Installing:

docker-ce x86_64 3:20.10.7-3.el7 docker-ce-stable 27 M

Installing for dependencies:

container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k

containerd.io x86_64 1.4.6-3.1.el7 docker-ce-stable 34 M

docker-ce-cli x86_64 1:20.10.7-3.el7 docker-ce-stable 33 M

docker-ce-rootless-extras x86_64 20.10.7-3.el7 docker-ce-stable 9.2 M

docker-scan-plugin x86_64 0.8.0-3.el7 docker-ce-stable 4.2 M

fuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 k

fuse3-libs x86_64 3.6.1-4.el7 extras 82 k

slirp4netns x86_64 0.4.3-4.el7_8 extras 81 k

Transaction Summary

======================================================================================================

Install 1 Package (+8 Dependent packages)

Total download size: 107 M

Installed size: 438 M

Downloading packages:

warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY

Public key for container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm is not installed

(1/9): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:00

warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-20.10.7-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY

Public key for docker-ce-20.10.7-3.el7.x86_64.rpm is not installed

(2/9): docker-ce-20.10.7-3.el7.x86_64.rpm | 27 MB 00:00:06

(3/9): containerd.io-1.4.6-3.1.el7.x86_64.rpm | 34 MB 00:00:08

(4/9): docker-ce-rootless-extras-20.10.7-3.el7.x86_64.rpm | 9.2 MB 00:00:02

(5/9): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm | 54 kB 00:00:00

(6/9): slirp4netns-0.4.3-4.el7_8.x86_64.rpm | 81 kB 00:00:00

(7/9): fuse3-libs-3.6.1-4.el7.x86_64.rpm | 82 kB 00:00:00

(8/9): docker-scan-plugin-0.8.0-3.el7.x86_64.rpm | 4.2 MB 00:00:01

(9/9): docker-ce-cli-20.10.7-3.el7.x86_64.rpm | 33 MB 00:00:08


Total 7.1 MB/s | 107 MB 00:00:15

Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

Importing GPG key 0x621E9F35:

Userid : “Docker Release (CE rpm) docker@docker.com

Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35

From : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

Importing GPG key 0xF4A80EB5:

Userid : “CentOS-7 Key (CentOS 7 Official Signing Key) security@centos.org

Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5

From : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 1/9

Installing : containerd.io-1.4.6-3.1.el7.x86_64 2/9

Installing : 1:docker-ce-cli-20.10.7-3.el7.x86_64 3/9

Installing : docker-scan-plugin-0.8.0-3.el7.x86_64 4/9

Installing : slirp4netns-0.4.3-4.el7_8.x86_64 5/9

Installing : fuse3-libs-3.6.1-4.el7.x86_64 6/9

Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64 7/9

Installing : docker-ce-rootless-extras-20.10.7-3.el7.x86_64 8/9

Installing : 3:docker-ce-20.10.7-3.el7.x86_64 9/9

Verifying : containerd.io-1.4.6-3.1.el7.x86_64 1/9

Verifying : fuse3-libs-3.6.1-4.el7.x86_64 2/9

Verifying : docker-scan-plugin-0.8.0-3.el7.x86_64 3/9

Verifying : slirp4netns-0.4.3-4.el7_8.x86_64 4/9

Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 5/9

Verifying : 3:docker-ce-20.10.7-3.el7.x86_64 6/9

Verifying : 1:docker-ce-cli-20.10.7-3.el7.x86_64 7/9

Verifying : docker-ce-rootless-extras-20.10.7-3.el7.x86_64 8/9

Verifying : fuse-overlayfs-0.7.2-6.el7_8.x86_64 9/9

Installed:

docker-ce.x86_64 3:20.10.7-3.el7

Dependency Installed:

container-selinux.noarch 2:2.119.2-1.911c772.el7_8 containerd.io.x86_64 0:1.4.6-3.1.el7

docker-ce-cli.x86_64 1:20.10.7-3.el7 docker-ce-rootless-extras.x86_64 0:20.10.7-3.el7

docker-scan-plugin.x86_64 0:0.8.0-3.el7 fuse-overlayfs.x86_64 0:0.7.2-6.el7_8

fuse3-libs.x86_64 0:3.6.1-4.el7 slirp4netns.x86_64 0:0.4.3-4.el7_8

Complete!

[root@ccx yum.repos.d]#

[root@ccx ~]# systemctl enable docker --now

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[root@ccx ~]#

[root@ccx ~]# docker info

Client:

Context: default

Debug Mode: false

Plugins:

app: Docker App (Docker Inc., v0.9.1-beta3)

buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

scan: Docker Scan (Docker Inc., v0.8.0)

Server:

Containers: 0

Running: 0

Paused: 0

Stopped: 0

Images: 4

Server Version: 20.10.7

Storage Driver: overlay2

Backing Filesystem: xfs

Supports d_type: true

Native Overlay Diff: true

userxattr: false

Logging Driver: json-file

Cgroup Driver: cgroupfs

Cgroup Version: 1

Plugins:

Volume: local

Network: bridge host ipvlan macvlan null overlay

Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog

Swarm: inactive

Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2

Default Runtime: runc

Init Binary: docker-init

containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d

runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7

init version: de40ad0

Security Options:

seccomp

Profile: default

Kernel Version: 3.10.0-957.el7.x86_64

Operating System: CentOS Linux 7 (Core)

OSType: linux

Architecture: x86_64

CPUs: 2

Total Memory: 3.701GiB

Name: ccx

ID: 5FW3:5O7N:PZTJ:YUAT:GFXD:QEGA:GOA6:C2IE:I2FJ:FUQE:D2QT:QI6A

Docker Root Dir: /var/lib/docker

Debug Mode: false

Registry: https://index.docker.io/v1/

Labels:

Experimental: false

Insecure Registries:

127.0.0.0/8

Live Restore Enabled: false

[root@ccx ~]#

离线安装

===================================================================

说明


  • 先准备一台能通外网的服务器,通过上面方法配置yum源【最好是centos系统】

  • 下载离线包的主机必须是没有安装docker-ce,如果已经安装,先卸载包及其依赖,方法见下面这个博客

【yum】linux离线安装rpm包及其依赖和卸载包及其依赖

docker的rpm包准备


  • rpm包正常情况一共有9个

  • 需要i使用到下面的2条命令,命令说明如下

  • mkdir /docker :用于存放下载的包

  • yum install docker-ce -y --downloaddir=/docker --downloadonly

- -downloaddir=/docker:存放路径

- -downloadonly:只下载不安装

[root@ccx ~]# mkdir /docker

[root@ccx ~]# yum install docker-ce -y --downloaddir=/docker --downloadonly

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

Resolving Dependencies

–> Running transaction check

—> Package docker-ce.x86_64 3:20.10.7-3.el7 will be installed

–> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Processing Dependency: containerd.io >= 1.4.1 for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Processing Dependency: docker-ce-cli for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.7-3.el7.x86_64

–> Running transaction check

—> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed

—> Package containerd.io.x86_64 0:1.4.6-3.1.el7 will be installed

—> Package docker-ce-cli.x86_64 1:20.10.7-3.el7 will be installed

–> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.7-3.el7.x86_64

—> Package docker-ce-rootless-extras.x86_64 0:20.10.7-3.el7 will be installed

–> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64

–> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.7-3.el7.x86_64

–> Running transaction check

—> Package docker-scan-plugin.x86_64 0:0.8.0-3.el7 will be installed

—> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed

–> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64

–> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64

–> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64

—> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed

–> Running transaction check

—> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================

Package Arch Version Repository Size

===============================================================================================================

Installing:

docker-ce x86_64 3:20.10.7-3.el7 docker-ce-stable 27 M

Installing for dependencies:

container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k

containerd.io x86_64 1.4.6-3.1.el7 docker-ce-stable 34 M

docker-ce-cli x86_64 1:20.10.7-3.el7 docker-ce-stable 33 M

docker-ce-rootless-extras x86_64 20.10.7-3.el7 docker-ce-stable 9.2 M

docker-scan-plugin x86_64 0.8.0-3.el7 docker-ce-stable 4.2 M

fuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 k

fuse3-libs x86_64 3.6.1-4.el7 extras 82 k

slirp4netns x86_64 0.4.3-4.el7_8 extras 81 k

Transaction Summary

===============================================================================================================

Install 1 Package (+8 Dependent packages)

Ending

Tip:由于文章篇幅有限制,下面还有20个关于MySQL的问题,我都复盘整理成一份pdf文档了,后面的内容我就把剩下的问题的目录展示给大家看一下

如果觉得有帮助不妨【转发+点赞+关注】支持我,后续会为大家带来更多的技术类文章以及学习类文章!(阿里对MySQL底层实现以及索引实现问的很多)

吃透后这份pdf,你同样可以跟面试官侃侃而谈MySQL。其实像阿里p7岗位的需求也没那么难(但也不简单),扎实的Java基础+无短板知识面+对某几个开源技术有深度学习+阅读过源码+算法刷题,这一套下来p7岗差不多没什么问题,还是希望大家都能拿到高薪offer吧。

《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》点击传送门,即可获取!

===============================================================================================================

Install 1 Package (+8 Dependent packages)

Ending

Tip:由于文章篇幅有限制,下面还有20个关于MySQL的问题,我都复盘整理成一份pdf文档了,后面的内容我就把剩下的问题的目录展示给大家看一下

如果觉得有帮助不妨【转发+点赞+关注】支持我,后续会为大家带来更多的技术类文章以及学习类文章!(阿里对MySQL底层实现以及索引实现问的很多)

[外链图片转存中…(img-2x8qhGZH-1714473520207)]

[外链图片转存中…(img-0f1ixO7K-1714473520208)]

吃透后这份pdf,你同样可以跟面试官侃侃而谈MySQL。其实像阿里p7岗位的需求也没那么难(但也不简单),扎实的Java基础+无短板知识面+对某几个开源技术有深度学习+阅读过源码+算法刷题,这一套下来p7岗差不多没什么问题,还是希望大家都能拿到高薪offer吧。

《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》点击传送门,即可获取!

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值