在redhat6上装1.8以下的docker

Posted huhujizhuanyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在redhat6上装1.8以下的docker相关的知识,希望对你有一定的参考价值。

因为目前1.8以上的docker最低要求是3.10的Linux内核,而我的内核版本远低于此。

1 [[email protected] home]# uname -r
2 2.6.32-754.11.1.el6.x86_64

鉴于我的vm上有一堆的dependency,并且没有太多的时间来把内核升级,所以只能咬牙在redhat6的环境下装docker,先把不能把代码mount到另外一台ubuntu上跑unittest这个事情给解决了(这里我想吐槽管杀不管埋的IT一百遍)。

docker主要依赖于CE(社区版,一般已经很够用了),它的主要依赖包如下:(这个是1.7版本的,从网上看到的)

lxc-libs-1.0.9-1.el6.x86_64.rpm
lua-alt-getopt-0.7.0-1.el6.noarch.rpm
lua-filesystem-1.4.2-1.el6.x86_64.rpm
lua-lxc-1.0.9-1.el6.x86_64.rpm
lxc-1.0.9-1.el6.x86_64.rpm
docker-io-1.7.1-2.el6.x86_64.rpm

device-mapper-libs-1.02.117-12.el6.i686.rpm
device-mapper-libs-1.02.117-12.el6.x86_64.rpm

但是我想用yum下载并安装,所以为了以防万一,我先装了个epel-release。EPEL (Extra Packages for Enterprise Linux)是基于Fedora的一个项目,为“红帽系”的操作系统提供额外的软件包,适用于RHEL、CentOS和Scientific Linux.

 1 [[email protected] Downloads]# yum -y install epel-release 
2 Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
3 Updating certificate-based repositories.
4 Unable to read consumer identity
5
epel | 4.7 kB 00:00
6 itaas | 2.0 kB 00:00
7 itaas-extras | 1.8 kB 00:00
8 itaas-optional | 2.0 kB 00:00
9 itaas-supplementary | 2.0 kB 00:00
10 Setting up Install Process
11 Package epel-release-6-8.noarch already installed and latest version
12 Nothing to do

安装成功后,yum的源可以看到

 1 [[email protected] Downloads]# yum repolist  
2
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
3
Updating certificate-based repositories.
4 Unable to read consumer identity
5 repo id repo name status
6 epel Extra Packages for Enterprise Linux 6 - x86_64 12,503
7 itaas itaas 20,720
8 itaas-extras itaas extras yum repo 97
9 itaas-optional itaas optional yum repo 11,997
10 itaas-supplementary itaas supplementary yum repo 896 11 repolist: 46,213

查找docker相应的依赖包

 1 [[email protected] etc]# yum search docker
 2 Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
 3 Updating certificate-based repositories.
 4 Unable to read consumer identity
 5 ============================================================================================== N/S Matched: docker ===============================================================================================
 6 docker-io-fish-completion.x86_64 : fish completion files for docker
 7 docker-io-logrotate.x86_64 : cron job to run logrotate on docker containers
 8 docker-io-vim.x86_64 : vim syntax highlighting files for docker
 9 docker-io-zsh-completion.x86_64 : zsh completion files for docker
10 fedora-dockerfiles.x86_64 : Example dockerfiles to assist standing up containers quickly
11 golang-github-docker-libtrust-unit-test.x86_64 : Unit tests for golang-github-docker-libtrust package
12 golang-github-docker-spdystream-unit-test.x86_64 : Unit tests for golang-github-docker-spdystream package
13 golang-github-fsouza-go-dockerclient-devel.noarch : Client for the Docker remote API
14 golang-github-fsouza-go-dockerclient-unit-test.x86_64 : Unit tests for golang-github-fsouza-go-dockerclient package
15 imagefactory-plugins-Docker.noarch : Cloud plugin for Docker
16 python-docker-py.x86_64 : An API client for docker written in Python
17 python-docker-registry-core.noarch : Core package for docker-registry (drivers) developers
18 python-dockerfile-parse.noarch : Python library for Dockerfile manipulation
19 docker.x86_64 : KDE and GNOME2 system tray replacement docking application
20 docker-io.x86_64 : Automates deployment of containerized applications
21 docker-io-devel.x86_64 : A golang registry for global request variables (source libraries)
22 golang-github-docker-libcontainer.x86_64 : Configuration options for containers
23 golang-github-docker-libcontainer-devel.x86_64 : Configuration options for containers
24 golang-github-docker-libtrust-devel.noarch : Library for managing authentication and authorization
25 golang-github-docker-spdystream-devel.noarch : A multiplexed stream library using spdy
26 
27   Name and summary matches only, use "search all" for everything.

安装docker必须的依赖包,以为有些依赖包之间也存在依赖关系,所以有些装完,被依赖的包也就顺便一起装了。

1 [[email protected] etc]# yum install -y docker
2 [[email protected] etc]# yum install -y lua-lxc.x86_64
3 [[email protected] etc]# yum install -y lxc.x86_64
4 [[email protected] etc]# yum install -y docker-io.x86_64
5 [[email protected] etc]# yum install -y device-mapper-libs.i686
6 [[email protected] etc]# yum install -y device-mapper-libs.x86_64

然后把docker的service打开,确认docker是否装上了

1 [[email protected] docker]# service docker start
2 Starting docker:                                       [  OK  ]
3 [[email protected] docker]# docker info

这里需要注意一下,因为是redhat6,所以只有service,没有systemctl。这里还关系到另外一个问题,就是尽量不要把docker的存储位置迁移。

目前网上所教的方法,有如下几种:

1. 是把/var/lib/docker整个路径下的文件都拷贝到其他位置,然后再软链接回来。

2.是把/var/lib/docker整个路径下的文件都拷贝到其他位置,然后修改docker.service,

  • --graph=/data/docker:docker新的存储位置
  • --storage-driver=overlay : 当前docker所使用的存储驱动

虽然这俩方法都挺好的,但是redhat6的service写法于redhat7不同,并且我们这里装的docker版本比较低,软链接回来,有些路径依旧不对,docker pull会不起作用,并且明面上不会有报错。所以最好不迁移。

 

以上是关于在redhat6上装1.8以下的docker的主要内容,如果未能解决你的问题,请参考以下文章

经验在群晖docker上装elmlang可视调试编码器ellie

Mac 上装了Docker,但我的Docker服务怎么对外开放

Mac 上装了Docker,但我的Docker服务怎么对外开放

Linux 下安装idea,提示svn版本太低问题

在Windows上更新docker compose为1.8

denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock.......(代码片