Linux下docker的安裝


前言

      由於以前在本身的mac上直接使用HomeBrew的包管理安裝的,使用brew install docker便可,這種方法簡單,但最近想嘗試在Linux下安裝,費了一些時間,主要是啓動docker時報異常 Failed to start docker.service: Unit not found.下面是本身安裝的步驟。linux

     安裝前準備:

  •      先查看linux內核信息及操做系統信息docker

  1.       linux版本及內核信息可用 uname -a ,從下圖可知,內核爲64位版本爲3.10.0 socket

  2.       cat /proc/version //查看當前操做系統版本信息工具

  3.       cat /etc/redhat-release  //查看版本當前操做系統發行版信息ui

  4.      從圖中可知linux內核爲3.10.0 操做系統發行版本爲Red Hat 7.2spa

  • 官網上寫的從Read Hat 7開始才支持安裝
    Docker is supported on Red Hat Enterprise Linux 7.
    Docker requires a 64-bit OS and version 3.10 or higher of the Linux kernel.

    官網地址https://docs.docker.com/install/linux/docker-ee/rhel/#prerequisites
    • 因此環境準備徹底知足

     安裝:

  •  下載安裝libcgroup的rpm包(該軟件包提供了一系列工具和庫文件用於控制和管理控制組)
  1. 下載libcgroup的rpm包: wget ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/updates/fastbugs/libcgroup-0.40.rc1-6.el6_5.1.x86_64.rpm
  2. 安裝libcgroup的rpm包: rpm -ivh libcgroup-0.40.rc1-6.el6_5.1.x86_64.rpm
  •  更新yum源(當前yum源裏可能沒有docker):    
  1. 先下載epel的rpm包:        wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
  2. 安裝epel的rpm包:rpm -ivh epel-release-latest-6.noarch.rp
  • 安裝docker: yum install docker-io

 

  •  安裝完後啓動docker的服務:service docker start 後報unit not found,以下圖所示

 

  • 通過查詢說是在目錄/usr/lib/systemd/system下少一個docker.socket的文件,可是安裝的docker是1.13.1的版本不須要此文件的; 
  • 無奈之下,以後從新安裝,仍然使用yum install docker-io 命令;
  • 此時奇蹟出現了,再次使用service docker start時,啓動成功了;

相關文章
相關標籤/搜索