在 CentOS 6.4(64位) 安裝 docker.io
Docker.io 是輕量級的“容器引擎+映像倉庫”,在LXC(linux輕量級容器)的基礎上構建,可以執行任何應用程式。
docker.io的核心層由以下幾個部分組成:
1、可執行程式,“/usr/bin/docker”
2、docker.io網站上有一系列建立好的作業系統和應用程式映像
3、AUFS(另一個統一檔案系統)來實現檔案系統的快照,檔案變化,控制只讀或讀寫的需求。
4、LXC(Linux輕量級容器)
5、Cgroups(各種資源和名稱空間的管理)
在本文寫作的時候,最新版本是0.5.3,但目前開發很活躍,一些功能和特性可能在新版本中會發生變化。
按下面的步驟安裝docker.io:
0、安裝centos6.x
1、因為selinux和LXC有衝突,所以需要禁用
[[email protected] ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=disabled # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted
sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
3、配置hop5.in源
cd /etc/yum.repos.d sudo wget http://www.hop5.in/yum/el6/hop5.repo
4、安裝docker-io
[[email protected] ~]# yum install docker-io Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: centos.excellmedia.net * epel: kartolo.sby.datautama.net.id * extras: centos.excellmedia.net * updates: centos.excellmedia.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package docker-io.x86_64 0:0.5.3-4.el6 will be installed --> Processing Dependency: lxc >= 0.8.0 for package: docker-io-0.5.3-4.el6.x86_64 --> Processing Dependency: kernel-ml-aufs >= 3.10.5 for package: docker-io-0.5.3-4.el6.x86_64 --> Running transaction check ---> Package kernel-ml-aufs.x86_64 0:3.10.5-3.el6 will be installed ---> Package lxc.x86_64 0:0.8.0-3.el6 will be installed --> Processing Dependency: liblxc.so.0()(64bit) for package: lxc-0.8.0-3.el6.x86_64 --> Running transaction check ---> Package lxc-libs.x86_64 0:0.8.0-3.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================ Package Arch Version Repository Size ============================================================================================ Installing: docker-io x86_64 0.5.3-4.el6 hop5 1.2 M Installing for dependencies: kernel-ml-aufs x86_64 3.10.5-3.el6 hop5 33 M lxc x86_64 0.8.0-3.el6 hop5 81 k lxc-libs x86_64 0.8.0-3.el6 hop5 75 k Transaction Summary ============================================================================================ Install 4 Package(s) Total download size: 34 M Installed size: 159 M Is this ok [y/N]: y Downloading Packages: (1/4): docker-io-0.5.3-4.el6.x86_64.rpm | 1.2 MB 00:03 (2/4): kernel-ml-aufs-3.10.5-3.el6.x86_64.rpm | 33 MB 00:33 (3/4): lxc-0.8.0-3.el6.x86_64.rpm | 81 kB 00:00 (4/4): lxc-libs-0.8.0-3.el6.x86_64.rpm | 75 kB 00:00 -------------------------------------------------------------------------------------------- Total 896 kB/s | 34 MB 00:39 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : lxc-libs-0.8.0-3.el6.x86_64 1/4 Installing : lxc-0.8.0-3.el6.x86_64 2/4 Installing : kernel-ml-aufs-3.10.5-3.el6.x86_64 3/4 Installing : docker-io-0.5.3-4.el6.x86_64 4/4 Verifying : kernel-ml-aufs-3.10.5-3.el6.x86_64 1/4 Verifying : lxc-0.8.0-3.el6.x86_64 2/4 Verifying : lxc-libs-0.8.0-3.el6.x86_64 3/4 Verifying : docker-io-0.5.3-4.el6.x86_64 4/4 Installed: docker-io.x86_64 0:0.5.3-4.el6 Dependency Installed: kernel-ml-aufs.x86_64 0:3.10.5-3.el6 lxc.x86_64 0:0.8.0-3.el6 lxc-libs.x86_64 0:0.8.0-3.el6 Complete! [[email protected] ~]#
5、檢查安裝情況
[[email protected] ~]# docker -h Usage of docker: -D=false: Debug mode -H=[unix:///var/run/docker.sock]: tcp://host:port to bind/connect to or unix://path/to/socket to use -api-enable-cors=false: Enable CORS requests in the remote api. -b="": Attach containers to a pre-existing network bridge. Use 'none' to disable container networking -d=false: Daemon mode -dns="": Set custom dns servers -g="/var/lib/docker": Path to graph storage base dir. -p="/var/run/docker.pid": File containing process PID -r=false: Restart previously running containers
6、要想docker正常執行還需要在/etc/fstab裡增加cgroup檔案系統
[[email protected] ~]# echo "none /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab [[email protected] ~]# mount /sys/fs/cgroup
只有重新啟動才能掛載/sys/fs/cgroup(因為當前執行的核心不支援cgroup),所以上面掛載的命令也可以不執行,但系統需要重新啟動。
7、重啟系統,選擇“3.10.5-3.el6.x86_64”核心
8、系統啟動後,確認當前執行的核心
[[email protected] ~]# uname -r 3.10.5-3.el6.x86_64 [[email protected] ~]# grep aufs /proc/filesystems nodev aufs
9、以守護模式執行docker.io(在一個新的終端裡)
[[email protected] ~]# docker -d 2013/08/21 07:47:07 WARNING: Your kernel does not support cgroup swap limit. 2013/08/21 07:47:07 Listening for HTTP on /var/run/docker.sock (unix)
10、在centos6.4容器裡輸出hello world
[[email protected] ~]# docker run centos:6.4 echo "hello world" 2013/08/21 07:48:41 POST /v1.4/containers/create 2013/08/21 07:48:41 POST /v1.4/containers/c6bc9e80097e/start 2013/08/21 07:48:41 POST /v1.4/containers/c6bc9e80097e/attach?logs=1&stderr=1&stdout=1&stream=1 hello world
11、從容器裡測試ping
[[email protected] ~]# docker -dns '8.8.8.8' run centos:6.4 ping -c 3 yahoo.com 2013/08/21 08:02:15 POST /v1.4/containers/create 2013/08/21 08:02:15 POST /v1.4/containers/c40a1244f9bc/start 2013/08/21 08:02:15 POST /v1.4/containers/c40a1244f9bc/attach?logs=1&stderr=1&stdout=1&stream=1 PING yahoo.com (98.138.253.109) 56(84) bytes of data. 64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=1 ttl=48 time=323 ms 64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=2 ttl=48 time=329 ms 64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=3 ttl=49 time=302 ms --- yahoo.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2304ms rtt min/avg/max/mdev = 302.032/318.318/329.656/11.807 ms
常見錯誤:
"DNS/Networking Errors inside the docker"
[[email protected] ~]# docker -dns="8.8.8.8" run centos:6.4 yum install hiphop-php 2013/08/21 07:53:05 POST /v1.4/containers/create 2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/start 2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/attach?logs=1&stderr=1&stdout=1&stream=1 Loaded plugins: fastestmirror Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
可以執行下面的命令來重置docker的執行環境,從而解決上述問題。
pkill docker iptables -t nat -F ifconfig docker0 down brctl delbr docker0 docker -d
感謝sciurus在建立kernel-ml-aufs的相關檔案時付出的辛勤工作。
http://www.oschina.net/translate/nstalling-dockerio-on-centos-64-64-bit?cmp
相關推薦
在 CentOS 6.4(64位) 安裝 docker.io
Docker.io 是輕量級的“容器引擎+映像倉庫”,在LXC(linux輕量級容器)的基礎上構建,可以執行任何應用程式。 docker.io的核心層由以下幾個部分組成: 1、可執行程式,“/usr/bin/docker” 2、docker.io網站上有一系列建立好的作業系統和應用程式映像 3、A
CentOS 7.4 64位安裝配置MySQL8.0
第一步:獲取mysql YUM源 image.png 點選下載 image.png 獲取到下載連結:https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm 第二步:下載和安
騰訊雲CentOS 7.4 64位安裝Redis並開啟遠端連線
在騰訊雲CentOS 7.4 64位安裝Redis。安全組預設先開放所有埠。使用Xshell+FileZilla操作更方便安裝Redis第一步:下載redis安裝包(具體版本請自行檢視網站)wget http://download.redis.io/releases/redis-4.0
mariadb 5.5.36 linux下CentOS 6.5 64位安裝【給力詳細教程】
一.通過YUN方式安裝MARIADB 1、軟體環境: CentOS 6.5 x64 MariaDB 5.5.36 2、安裝過程 1)在/etc/yum.repos.d/目錄建立MariaDB.repo檔案,內容如下: # MariaDB 10.0 CentOS reposi
linux 6.4(64位)系統vsftpd、ftp服務安裝操作處理方法
linux 6.4(64位)系統vsftpd、ftp服務安裝操作處理方法 1.linux 系統本身的vsftpd服務安裝 1)檢查vsftpd服務狀態,檢視是否是啟動狀態 service vsftpd status chkconfig
CentOS6.4(64位)安裝Mysql5.6
JIRA配置外部資料庫需要安裝mysql,這裡選擇5.6版本的二進位制安裝。 下載: 解壓到/usr/local/mysql: tar -xf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz -C /usr/lo
redhat enterprise linux 6.4 64位系統安裝sybase
安裝環境及版本Redhat Enterprise Linux 6.4 64位Vmware Workstation 10ase15.7 64位 檢視redhat版本及位數等資訊命令: uname -a 安裝包下載: http://pan.baidu.com/s/1bnpTE
Linux CentOS 6.9 64位雲主機 靜默安裝Oracle11g和配置
通過SSH遠端連線雲主機,上傳oracle11g安裝包,在centos6.9上無圖形化介面靜默安裝oracle11g。 工具&環境 1、本地環境windows8+ssh遠端連線工具CRT7.3.3 2、遠端雲主機CentOS6.9 64位系統
阿裏雲CentOS 7.4 64位,jdk1.6、mysql5.7、tomcat6部署步驟(個人記錄)
安裝包 serve har server tar.gz utf8 cat pps lar jdk1.6、mysql5.7、tomcat6部署步驟 一、安裝jdk1.6 查看當前系統jdk的版本:java -version 方法一:利用yum源來安裝jdk(此方
ubuntu 16.04 64位安裝docker
ubuntu docker 準備1.添加GPG key:$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D2.添
RedHat 6.8 64位安裝ASM
asm redhat6.8 安裝ASM需要三個包:oracleasm-supportoracleasmlibkmod-oracleasm 前面兩個包可以在oracle的官網上下載,http://www.oracle.com/technetwork/server-storage/linux/asmlib
centos7.4 64位安裝 google-chrome 與 chromedriver 運行 Python selenium 項目
set 谷歌瀏覽器 common efs col 實例 entos disable exec centos7.4 實例 利用 yum 命令安裝 google-chrome 超級簡單(安裝最新版): yum install https://dl.google.com
ubunutu16.4 64位安裝arm-linux-gcc交叉編譯器
網上有很多的安裝交叉編譯的方法,但是照做後,發現arm-linux-gcc發現提示 那麼怎麼處理呢? 接下來一步步記錄下吧! 這裡是使用的是arm-linux-gcc-4.5.1在友善之壁官網可以下載。 1:將arm-linux-gcc-4.5.1-v6-vf
Linux下Mysql的資料庫備份(基於 CentOS 7.4 64位)
在做專案的時候,經常會需要對資料庫進行備份,基於Linux系統下的操作我還是第一次做,所以在網上查詢了很多資料,分別參考了https://www.cnblogs.com/batsing/p/4938986.html 和 ht
騰訊雲CentOS 7.2 64位安裝Mongodb
如果 .com () epo 查看 bsp logs 無法連接 inline 一、安裝步驟:1、配置MongoDB的yum源:創建yum源文件:vim /etc/yum.repos.d/mongodb-org-3.4.repo 2、mongodb-org-3.4.repo
CentOS-6.4-x86_64-bin 安裝JDK1.8 和 Tomcat 8
JDK 安裝 JDK 安裝包:jdk-8u161-linux-x64.tar.gz 安裝在 usr/jdk(新建目錄) 解壓命令:tar -zxvf jdk-8u161-linux-x64.tar.gz 配置jdk環境:vim /etc/profile 回車 末尾加jdk環境
CentOS-6.4-x86_64-bin 安裝MySQL過程中出現的問題
RT 本人安裝的Linux版本:CentOS-6.4-x86_64-bin-DVD1.iso 安裝mysql (rpm方式) 安裝在usr/mysql(新建目錄) 需要準備的rpm: MySQL-server-5.5.59-1.el6.x86_64.rpm openssl-1.0
阿里雲伺服器Centos 6.8 64位漏洞 CVE-2017-5336 處理
RHSA-2017:0574 漏洞包括四個,分別是 CVE-2017-5336(GnuTLS 存在棧緩衝區溢位的漏洞)、CVE-2017-5337(GnuTLS 存在堆緩衝區溢位漏洞)、CVE-2017-5335(GnuTLS 存在基於緩衝區溢位的漏洞)和 CVE-2016-8610(Op
CentOS 6.4下編譯安裝MySQL 5.6.14
概述: CentOS 6.4下通過yum安裝的MySQL是5.1版的,比較老,所以就想通過原始碼安裝高版本的5.6.14。 正文: 一:解除安裝舊版本 使用下面的命令檢查是否安裝有MySQL Server rpm -qa | grep mysql 有的話通過下面的命令來解除安裝掉 rpm -e
在CentOS 6.4中編譯安裝GCC 4.8.1 + GDB 7.6.1
在CentOS 6.4中編譯安裝GCC 4.8.1 + GDB 7.6.1 一、編譯安裝gcc 4.8.1 1. 安裝gcc和g++ 新安裝的CentOS缺少編譯環境,必須先安裝舊版本的gcc, 然後再進行自舉編譯 yum -y install gcc yum -y i