Centos下Docker安装指定版本 您所在的位置:网站首页 下载指定版本docker Centos下Docker安装指定版本

Centos下Docker安装指定版本

#Centos下Docker安装指定版本| 来源: 网络整理| 查看: 265

参考官网:https://www.docker.com/products/docker#/linux

一般情况下,docker安装可以使用官网推荐的自动安装脚本,

curl -sSL https://get.docker.com/ | sh

这样可以安装最新的docker-engine,如果因为某些特殊原因,比如机器上的selinux版本不符合docker-engine最新版本的依赖要求,可以使用如下方法手动安装执行的docker版本。

以安装docker-engine-1.12.1为例,以下是安装和初步配置过程

# 如果国内无法连接docker的官方源,可以设置代理,此步骤可略过 export http_proxy=http://10.16.3.70:3128 export https_proxy=https://10.16.3.70:3128 # 清理残余的docker版本 yum -y remove docker docker-common container-selinux yum -y remove docker-selinux # 安装工具yum-utils, 方便下一步设置yum源 yum install -y yum-utils yum-config-manager \ --add-repo \ https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo # 查看docker-engine的所有版本,找到期望版本的精确名字,如1.12.2-1.el7.centos # yum list docker-engine --showduplicates # 查看某个docker-engine版本的依赖,如1.12.1依赖docker-engine-selinux, 版本>= 1.12.1-1.el7.centos # yum deplist docker-engine-1.12.1-1.el7.centos # 由于docker-engine会默认安装docker-engine-selinux 13,而安装docker-engine-selinux 13需要将本机的selinux升级,所以手动安装docker-engine-selinux 12 yum -y install docker-engine-selinux-1.12.2-1.el7.centos # 安装docker engine yum -y install docker-engine-1.12.1-1.el7.centos #创建soft link systemctl enable docker # config docker storage and http_proxy #参考 https://docs.docker.com/engine/admin/systemd/ set +e declare unitConfig=/etc/systemd/system/docker.service.d/ mkdir $unitConfig cp ./start.conf $unitConfig cp ./http_proxy.conf $unitConfig set -e systemctl daemon-reload # start docker service docker start

配置docker使用了linux的单元配置,包括./start.conf和./http_proxy.conf

./http_proxy.conf主要是为了在docker pull时的http代理,内容如下:

[Service] Environment="HTTP_PROXY=http://10.16.3.70:3128/"

./start.conf是配置docker运行时容器的存储地址,以防docker默认的目录空间不够。

[Service] # 这句是为了unset ExecStart ExecStart= ExecStart=/usr/bin/dockerd --graph="/mnt/docker"



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有