使用RPM方式安装docker

使用RPM方式安装docker

通常网上提供的docker安装方式都是使用yum安装,但是如果一些环境无法连接外网(这种情况在生产环境很常见),通过离线安装方式安装docker就很有必要。本文主要介绍通过rpm方式安装docker。其中相关rpm包的下载地址来自:

https://centos.pkgs.org

https://yum.dockerproject.org/repo/main/centos/7/Packages/

 

安装说明:安装docker是会提示缺少依赖包,通常有systemd-devel systemd-libs libseccomp device-mapper-libs等。本文中安装的docker版本是1.12.6(缺少的依赖会因不同的服务器及不同的操作系统版本有所差异,我这里使用的操作系统是CentOS Linux release 7.1.1503 (Core)),RPM下载网站https://centos.pkgs.org中说明安装docker需要依赖的文件如下:

Requires

§ docker-client = 1.12.6-55.gitc4618fb.el7.centos

§ docker-common = 1.12.6-55.gitc4618fb.el7.centos

§ libassuan.so.0()(64bit)

§ libaudit.so.1()(64bit)

§ libc.so.6(GLIBC_2.9)(64bit)

§ libdevmapper.so.1.02()(64bit)

§ libdevmapper.so.1.02(Base)(64bit)

§ libdevmapper.so.1.02(DM_1_02_97)(64bit)

§ libdl.so.2()(64bit)

§ libgpg-error.so.0()(64bit)

§ libgpgme.so.11()(64bit)

§ libgpgme.so.11(GPGME_1.0)(64bit)

§ libgpgme.so.11(GPGME_1.1)(64bit)

§ libpthread.so.0()(64bit)

§ libpthread.so.0(GLIBC_2.2.5)(64bit)

§ libpthread.so.0(GLIBC_2.3.2)(64bit)

§ libseccomp.so.2()(64bit)

§ libsystemd.so.0()(64bit)

§ libsystemd.so.0(LIBSYSTEMD_209)(64bit)

§ rtld(GNU_HASH)

§ systemd

 

 

 

如下是本人在实际安装中缺少的依赖包:

 

docker-client = 2:1.12.6-55.gitc4618fb.el7.centos

docker-common=2:1.12.6-55.gitc4618fb.el7.centos          

libdevmapper.so.1.02(DM_1_02_97)(64bit)          

libsystemd.so.0()(64bit)

libsystemd.so.0(LIBSYSTEMD_209)(64bit)

 

 

下载相关的依赖RPM包,安装安装

安装systemd-libs

1.systemd-libs - systemd libraries

Distribution: CentOS 7

Repository: CentOS x86_64

Package name: systemd-libs

Package version: 219

Package release: 42.el7

Package architecture: x86_64

Package type: rpm

Installed size: 1.03 MB

Download size: 375.15 KB

Official Mirror: mirror.centos.org

Libraries for systemd and udev, as well as the systemd PAM module.


(安装时会提示和原来的低版本冲突,使用参数--force强制安装)

rpm -ivh systemd-libs-219-42.el7.x86_64.rpm  --force

 

安装device-mapper-libs

device-mapper-libs - Device-mapper shared library

Distribution: CentOS 7

Repository: CentOS x86_64

Package name: device-mapper-libs

Package version: 1.02.140

Package release: 8.el7

Package architecture: x86_64

Package type: rpm

Installed size: 391.08 KB

Download size: 311.91 KB

Official Mirror: mirror.centos.org

This package contains the device-mapper shared library, libdevmapper.


rpm -ivh device-mapper-1.02.140-8.el7.x86_64.rpm --nodeps --force

rpm -ivh device-mapper-libs-1.02.140-8.el7.x86_64.rpm --nodeps --force

 

安装docker-common

docker-common - Common files for docker and docker-latest

Distribution: CentOS 7

Repository: CentOS Extras x86_64

Package name: docker-common

Package version: 1.12.6

Package release: 55.gitc4618fb.el7.centos

Package architecture: x86_64

Package type: rpm

Installed size: 4.00 KB

Download size: 78.52 KB

Official Mirror: mirror.centos.org

This package contains the common files /usr/bin/docker which will point to /usr/bin/docker-current or /usr/bin/docker-latest configurable via /etc/sysconfig/docker

安装docker-common时,会提示缺少新的依赖包,如下:

Failed dependencies:

        container-selinux >= 2:2.21-2

        container-storage-setup >= 0.3.0-1

        oci-register-machine >= 1:0-3.10

        oci-systemd-hook >= 1:0.1.4-9

        oci-umount = 2:1.12.6-55.gitc4618fb.el7.centos

        skopeo-containers

 

下载后,接着安装缺少的依赖包

 

安装oci-umount

oci-umount - OCI umount hook for docker

Distribution: CentOS 7

Repository: CentOS Extras x86_64

Package name: oci-umount

Package version: 1.12.6

Package release: 55.gitc4618fb.el7.centos

Package architecture: x86_64

Package type: rpm

Installed size: 56.06 KB

Download size: 98.52 KB

Official Mirror: mirror.centos.org

OCI umount hooks unmount potential leaked mount points in a containers mount namespaces.


rpm -ivh oci-umount-1.12.6-55.gitc4618fb.el7.centos.x86_64.rpm

 

安装oci-systemd-hook

oci-systemd-hook - OCI systemd hook for docker

Distribution: CentOS 7

Repository: CentOS Extras x86_64

Package name: oci-systemd-hook

Package version: 0.1.14

Package release: 1.git1ba44c6.el7

Package architecture: x86_64

Package type: rpm

Installed size: 65.93 KB

Download size: 31.87 KB

Official Mirror: mirror.centos.org

OCI systemd hooks enable running systemd in a OCI runc/docker container


rpm -ivh oci-systemd-hook-0.1.14-1.git1ba44c6.el7.x86_64.rpm

 

安装oci-register-machine

oci-register-machine - Golang binary to register OCI containers with systemd-machined

Distribution: CentOS 7

Repository: CentOS Extras x86_64

Package name: oci-register-machine

Package version: 0

Package release: 3.13.gitcd1e331.el7

Package architecture: x86_64

Package type: rpm

Installed size: 3.22 MB

Download size: 1.06 MB

Official Mirror: mirror.centos.org

Golang binary to register OCI containers with systemd-machined


rpm -ivh oci-register-machine-0-3.13.gitcd1e331.el7.x86_64.rpm

 

 

安装skopeo-containers

skopeo-containers - Configuration files for working with image signature

Distribution: CentOS 7

Repository: CentOS Extras x86_64

Package name: skopeo-containers

Package version: 0.1.23

Package release: 1.git1bbd87f.el7

Package architecture: x86_64

Package type: rpm

Installed size: 1.12 KB

Download size: 8.36 KB

Official Mirror: mirror.centos.org

This package installs a default signature store configuration policy under `/etc/containers/`.


rpm -ivh skopeo-containers-0.1.23-1.git1bbd87f.el7.x86_64.rpm

安装container-storage-setup

container-storage-setup - A simple service to setup container storage devices

Distribution: CentOS 7

Repository: CentOS Extras x86_64

Package name: container-storage-setup

Package version: 0.7.0

Package release: 1.git4ca59c5.el7

Package architecture: noarch

Package type: rpm

Installed size: 92.64 KB

Download size: 32.36 KB

Official Mirror: mirror.centos.org

This is a simple service to configure Container Runtimes to use an LVM-managed thin pool. It also supports auto-growing both the pool as well as the root logical volume and partition table.


rpm -ivh container-storage-setup-0.7.0-1.git4ca59c5.el7.noarch.rpm

安装container-selinux

container-selinux - SELinux policies for container runtimes

Distribution: CentOS 7

Repository: CentOS Extras x86_64

Package name: container-selinux

Package version: 2.21

Package release: 2.gitba103ac.el7

Package architecture: noarch

Package type: rpm

Installed size: 33.08 KB

Download size: 28.91 KB

Official Mirror: mirror.centos.org

SELinux policy modules for use with container runtimes.


rpm -ivh container-selinux-2.21-2.gitba103ac.el7.noarch.rpm --nodeps

注意:安装该依赖包的时候,如果SELinux被设置为disabled状态,则会出现安装完成后无法自动退出安装的现象,需要强制退出后然后killrpm安装进程即可,如下图:

 

安装docker-client

rpm -ivh docker-client-1.12.6-55.gitc4618fb.el7.centos.x86_64.rpm

 

最后安装docker

 rpm -ivh docker-1.12.6-55.gitc4618fb.el7.centos.x86_64.rpm 



  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值