参考文档:https://docs.docker.com/engine/installation/linux/docker-ce/centos/#install-docker-ce

简介

docker包括:Community Edition (CE) and Enterprise Edition (EE),本文讲CE版本安装.

环境

CentOS release 6.8 (Final)

安装依赖

yum 开启centos-extras库,默认是开启的.如果被禁用,请参考:https://wiki.centos.org/AdditionalResources/Repositories 开启

安装步骤

1.删除旧版本的docker

如果有旧版本的docer,删除

$ sudo yum remove docker \
docker-common \
docker-selinux \
docker-engine

2.安装docker

安装docker有四种方式:

1.yum安装

2.通过tar包安装

3.通过在线脚本安装

2.1 yum安装docker

1.安装必要工具

$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

2.安装yum资源库文件

$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

3.开启docker-ce-edge资源库

$ sudo yum-config-manager --enable docker-ce-edge

4.安装docker

sudo yum install docker-ce

或者指定特定docker版本

$ yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64            17.09.ce-1.el7.centos             docker-ce-stable
* updates: mirrors.sohu.com
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
* extras: mirrors.sohu.com
docker-ce.x86_64 17.10.0.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.07.0.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.05.0.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.04.0.ce-1.el7.centos docker-ce-edge
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
* base: mirrors.sohu.com
Available Packages $ sudo yum install <FULLY-QUALIFIED-PACKAGE-NAME>

这里安装docker最新的stable版本

[root@docker01 ~]# yum install docker-ce-17.09.0.ce
………….
---> Package libtool-ltdl.x86_64 0:2.2.6-15.5.el6 will be installed
---> Package xz.x86_64 0:4.999.9-0.5.beta.20091007git.el6 will be installed
--> Finished Dependency Resolution
Error: Package: docker-ce-17.09.0.ce-1.el7.centos.x86_64 (docker-ce-edge)
Requires: libsystemd.so.0()(64bit)
Error: Package: docker-ce-17.09.0.ce-1.el7.centos.x86_64 (docker-ce-edge)
Requires: container-selinux >= 2.9
Error: Package: docker-ce-17.09.0.ce-1.el7.centos.x86_64 (docker-ce-edge)
Requires: libseccomp.so.2()(64bit)
Error: Package: docker-ce-17.09.0.ce-1.el7.centos.x86_64 (docker-ce-edge)
Requires: libsystemd.so.0(LIBSYSTEMD_209)(64bit)
Error: Package: docker-ce-17.09.0.ce-1.el7.centos.x86_64 (docker-ce-edge)
Requires: libc.so.6(GLIBC_2.17)(64bit)
Error: Package: docker-ce-17.09.0.ce-1.el7.centos.x86_64 (docker-ce-edge)
Requires: systemd-units
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

当前系统glibc是2.12很旧的版本,需要升级glibc到2.17,而glibc2.17是centos7上用的,鉴于在centos6上安装glibc2.17有风险,不升级glibc.docker官网已经不提供cetnos6的docker下载.

还好在https://pkgs.org/download/docker-io 找到了docker-io(docker centos6安装包)

wget http://dl.fedoraproject.org/pub/epel/testing/6/x86_64//docker-io-1.7.1-4.el6.x86_64.rpm
yum install docker-io-1.7.1-4.el6.x86_64.rpm
Requires: lxc

需要安装lxc,但是默认的repo没有lxc安装包

wget https://codeload.github.com/lxc/lxc/zip/stable-1.1
mv stable-1.1 lxc-stable-1.1.zip
unzip lxc-stable-1.1.zip
cd lxc-stable-1.1/
执行检查脚本:
./autogen.sh
+ test -d autom4te.cache
+ libtoolize
./autogen.sh: line 27: libtoolize: command not found
+ exit 1
#装libtool
yum install libtool -y
……
执行检查脚本:
lxc-stable-2.1]# ./autogen.sh
+ test -d autom4te.cache
+ aclocal -I config
+ autoheader
+ autoconf
+ automake --add-missing --copy
configure.ac:31: installing `config/compile'
configure.ac:30: installing `config/config.guess'
configure.ac:30: installing `config/config.sub'
configure.ac:29: installing `config/install-sh'
configure.ac:29: installing `config/missing'
src/lua-lxc/Makefile.am: installing `config/depcomp' #编译安装
./configure
……
configure: error: please install libcap-devel.

安装上面需要的包

yum install gnutls

2.2 tar安装

weg https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.09.0.ce-1.el7.centos.x86_64.rpm
sudo yum install /path/to/package.rpm
sudo systemctl start docker
sudo docker run hello-world

2.3 在线脚本

略,参考https://docs.docker.com/engine/installation/linux/docker-ce/centos/#install-using-the-convenience-script

事实证明以上的安装方式都行不通

mmp!

参考:http://www.cnblogs.com/zhenyuyaodidiao/p/5464422.html

安装epel

rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

安装docker

yum install docker-io
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink | 6.2 kB 00:00
* base: mirrors.aliyun.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.sohu.com
epel | 4.3 kB 00:00
epel/primary_db | 5.9 MB 00:01
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be installed
--> Processing Dependency: lxc for package: docker-io-1.7.1-2.el6.x86_64
--> Running transaction check
---> Package lxc.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.10-2.el6 for package: lxc-1.0.10-2.el6.x86_64
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.10-2.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.10-2.el6.x86_64
--> Running transaction check
---> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be installed
---> Package lua-lxc.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.10-2.el6.x86_64
---> Package lxc-libs.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: rsync for package: lxc-libs-1.0.10-2.el6.x86_64
--> Running transaction check
---> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be installed
---> Package rsync.x86_64 0:3.0.6-12.el6 will be installed
--> Finished Dependency Resolution Dependencies Resolved ==============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================
Installing:
docker-io x86_64 1.7.1-2.el6 epel 4.6 M
Installing for dependencies:
lua-alt-getopt noarch 0.7.0-1.el6 epel 6.9 k
lua-filesystem x86_64 1.4.2-1.el6 epel 24 k
lua-lxc x86_64 1.0.10-2.el6 epel 16 k
lxc x86_64 1.0.10-2.el6 epel 124 k
lxc-libs x86_64 1.0.10-2.el6 epel 258 k
rsync x86_64 3.0.6-12.el6 base 335 k Transaction Summary
=====================================================================================================================================================================================================
Install 7 Package(s) Total download size: 5.3 M
Installed size: 21 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): docker-io-1.7.1-2.el6.x86_64.rpm | 4.6 MB 00:04
(2/7): lua-alt-getopt-0.7.0-1.el6.noarch.rpm | 6.9 kB 00:00
(3/7): lua-filesystem-1.4.2-1.el6.x86_64.rpm | 24 kB 00:00
(4/7): lua-lxc-1.0.10-2.el6.x86_64.rpm | 16 kB 00:00
(5/7): lxc-1.0.10-2.el6.x86_64.rpm | 124 kB 00:00
(6/7): lxc-libs-1.0.10-2.el6.x86_64.rpm | 258 kB 00:00
(7/7): rsync-3.0.6-12.el6.x86_64.rpm | 335 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 502 kB/s | 5.3 MB 00:10
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <epel@fedoraproject.org>
Package: epel-release-6-8.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : lua-filesystem-1.4.2-1.el6.x86_64 1/7
Installing : lua-alt-getopt-0.7.0-1.el6.noarch 2/7
Installing : rsync-3.0.6-12.el6.x86_64 3/7
Installing : lxc-libs-1.0.10-2.el6.x86_64 4/7
Installing : lua-lxc-1.0.10-2.el6.x86_64 5/7
Installing : lxc-1.0.10-2.el6.x86_64 6/7
Installing : docker-io-1.7.1-2.el6.x86_64 7/7
Verifying : lua-lxc-1.0.10-2.el6.x86_64 1/7
Verifying : lxc-libs-1.0.10-2.el6.x86_64 2/7
Verifying : lxc-1.0.10-2.el6.x86_64 3/7
Verifying : docker-io-1.7.1-2.el6.x86_64 4/7
Verifying : rsync-3.0.6-12.el6.x86_64 5/7
Verifying : lua-alt-getopt-0.7.0-1.el6.noarch 6/7
Verifying : lua-filesystem-1.4.2-1.el6.x86_64 7/7 Installed:
docker-io.x86_64 0:1.7.1-2.el6 Dependency Installed:
lua-alt-getopt.noarch 0:0.7.0-1.el6 lua-filesystem.x86_64 0:1.4.2-1.el6 lua-lxc.x86_64 0:1.0.10-2.el6 lxc.x86_64 0:1.0.10-2.el6 lxc-libs.x86_64 0:1.0.10-2.el6 rsync.x86_64 0:3.0.6-12.el6 Complete!

注意:

最docker-1.10以后彻底放弃了lxc转而使用libcontainer(go).建议安装最新的docker使用centos7.

网易镜像:

http://mirrors.163.com/centos/7.3.1611/isos/x86_64/

1.centos6.8安装docker的更多相关文章

  1. 实战CENTOS6.5安装docker并创建asp.net mvc 5 镜像,运行MVC 网站

    Docker,容器,让研发.测试.生产同一环境,可在linux平台上混合使用JAVA与net 程序 Centos6.5安装docker 参考http://my.oschina.net/kcw/blog ...

  2. centos6.5安装docker(亲测)

    centos6.5下安装docker的过程办法 在看了网上N多复制粘贴的文章,又尝试无效后,我把我最终成功的办法发出来,希望能帮到拼命干环境的你. 操作环境: centos6.5(Final) 内核: ...

  3. docker入门之:centos6.5 安装docker

    centos6.5 : 使用EPEL库安装docker: # sudo yum install -y  http://mirrors.yun-idc.com/epel/6/i386/epel-rele ...

  4. CentOS6.8安装Docker

    在CentOS6.8上安装Docker 1.Docker使用EPEL发布,RHEL系的OS首先要确保已经持有EPEL仓库,否则先检查OS的版本,然后安装相应的EOEL包:如下命令: yum insta ...

  5. centos6.5linux安装docker之升级内核

    一.运行docker Linux内核版本需要在3.8以上,针对centos6.5 内核为2.6的系统需要先升级内核.不然会特别卡 在yum的ELRepo源中,有mainline(4.5).long-t ...

  6. 阿里云ECS服务器centos6.x安装docker问题盘点

    1.首先在centos6.x和centos7.x中yum安装docker的区分. centos6.x: yum install docker-io centos7.x: yum install doc ...

  7. [Docker] 在CentOS6.8 安装 Docker

    运行docker Linux内核版本需要在3.8以上,针对centos6.5 内核为2.6的系统需要先升级内核.不然会特别卡,退出容器. # 查看当前版本: cat /etc/issue # 导入pu ...

  8. centos6下安装docker

    安装docker对内核版本的要求很高,需要内核3.10以上. 一.docker卸载 查看内核版本: 如果不升级内核到3.10安装docker,后面会有很多奇怪的问题,像我就是拉取不到镜像. 以下我是r ...

  9. centos6.7 安装Docker

      一.查看系统版本 [root@localhost ~]# cat /etc/redhat-release CentOS release 6.7 (Final) 二.安装EPEL 1.进入cento ...

随机推荐

  1. 1555: Inversion Sequence (通过逆序数复原序列 vector的骚操作!!!)

    1555: Inversion Sequence Submit Page    Summary    Time Limit: 2 Sec     Memory Limit: 256 Mb     Su ...

  2. HDU 1257 最少拦截系统(贪心 or LIS)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1257 最少拦截系统 Time Limit: 2000/1000 MS (Java/Others)   ...

  3. 使用java发送QQ邮件的总结

    最近帮朋友做个网站,实现用邮箱订阅功能,所以现在把这个发送邮件的功能放在这里,算是这两天工作的总结吧! 首先,想要实现订阅功能,要把邮箱保存,但是这个做的是个小网站,前后台交互的太少了,所以我就直接保 ...

  4. Tomcat出现需要输入账号和密码问题

    这里是端口冲突问题: 可以做一下几个解决方案: 第一:更好Tomcat/conf/server.xml文件里面的制定8080端口号,更改为你能记住的端口数: 第二:找到冲突的端口的进程,杀死这个进程, ...

  5. linux学习第十七天(NFS、AUTOFS文件共享配置,DNS配置)

    一.NFS(网络文件系统,实现linux系统上文件共享) 服务器配置 yum install nfs-utils  (安装NFS软件包) iptables -F  (清空防火墙) service ip ...

  6. C语言学习记录_2019.02.08

    \n:换行:   \t:制表符,相当于大空格: a[5]={2};<------->a[5]={2,0,0,0,0}; 数组初始化的方法:a[5]={0};即全部初始化为0: 数组初始化的 ...

  7. ADI高速信号采集芯片与JESD204B接口简介

    ADI高速信号采集芯片与JESD204B接口简介 JESD204B接口 介绍: JEDEC Standard No. 204B (JESD204B)—A standardized serial int ...

  8. 【转】WCF扩展系列 - 行为扩展(Behaviors)

    原文:https://www.cnblogs.com/Creator/archive/2011/05/21/2052687.html 这个系列的第一部分将会重点关注WCF行为(behaviors),W ...

  9. 20155211 2016-2017-2 《Java程序设计》第九周学习总结

    20155211 2016-2017-2 <Java程序设计>第九周学习总结 教材学习内容总结 第十六章 整合数据库 一.JDBC入门 (一)JDBC简介 厂商在操作JDBC驱动程序时,依 ...

  10. 【BZOJ1053】[HAOI2007]反素数

    [BZOJ1053][HAOI2007]反素数 题面 bzoj 洛谷 题解 可以从反素数的定义看出小于等于\(x\)的最大反素数一定是约数个数最多且最小的那个 可以枚举所有的质因数来求反素数,但还是跑 ...