一、查看系統版本
目前,CentOS 僅發行版本中的內核支持 Docker。
Docker 運行在 CentOS 7 上,要求系統為64位、系統內核版本為 3.10 以上。
Docker 運行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系統為64位、系統內核版本為 2.6.32-431 或者更高版本。
[root@CentOS6 ~]# uname -a
Linux CentOS6.8 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@CentOS6 ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
二、安裝Docker
- Docker使用EPEL發布,RHEL系的OS首先要確保已經持有EPEL倉庫,否則先檢查OS的版本,然后安裝相應的EPEL包。
RHEL:Red Hat公司發布的面向企業用戶的Linux操作系統。
yum install -y epel-release
2. 執行命令:
yum install -y docker-io
然而:報錯了
[root@CentOS6 ~]# yum install -y docker-io
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
epel/metalink | 5.4 kB 00:00
* base: mirrors.njupt.edu.cn
* epel: mirrors.njupt.edu.cn
* extras: mirrors.njupt.edu.cn
* updates: mirrors.njupt.edu.cn
epel | 5.3 kB 00:00
epel/primary_db | 6.1 MB 00:07
No package docker-io available.
Error: Nothing to do
搜了各種答案,總結如下:
解決辦法1:
yum沒有找到docker包,更新epel第三方軟件庫,運行命令:
sudo yum install epel-release
之后再執行:
sudo yum install docker
然而我的卻還是報錯。
解決辦法2:
Ubuntu/Debian: curl -sSL https://get.docker.com | sh
Linux 64bit binary: https://get.docker.com/builds/Linux/x86_64/docker-1.7.1
Darwin/OSX 64bit client binary: https://get.docker.com/builds/Darwin/x86_64/docker-1.7.1
Darwin/OSX 32bit client binary: https://get.docker.com/builds/Darwin/i386/docker-1.7.1
Linux 64bit tgz: https://get.docker.com/builds/Linux/x86_64/docker-1.7.1.tgz
Windows 64bit client binary: https://get.docker.com/builds/Windows/x86_64/docker-1.7.1.exe
Windows 32bit client binary: https://get.docker.com/builds/Windows/i386/docker-1.7.1.exe
Centos 6/RHEL 6: https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm
Centos 7/RHEL 7: https://get.docker.com/rpm/1.7.1/centos-7/RPMS/x86_64/docker-engine-1.7.1-1.el7.centos.x86_64.rpm
Fedora 20: https://get.docker.com/rpm/1.7.1/fedora-20/RPMS/x86_64/docker-engine-1.7.1-1.fc20.x86_64.rpm
Fedora 21: https://get.docker.com/rpm/1.7.1/fedora-21/RPMS/x86_64/docker-engine-1.7.1-1.fc21.x86_64.rpm
Fedora 22: https://get.docker.com/rpm/1.7.1/fedora-22/RPMS/x86_64/docker-engine-1.7.1-1.fc22.x86_64.rpm
yum install docker-io,該命令是用源安裝docker,可是源一般是國外源,用這個命令因為GFW被牆,根本安裝不了
yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm
此時:成功安裝
3.安裝后的配置文件
[root@CentOS6 ~]# ls -l /etc/sysconfig/docker
-rw-r--r--. 1 root root 199 Jul 15 2015 /etc/sysconfig/docker
4. 啟動Docker后台服務
service docker start
5. Docker Version驗證
docker version