Monday, February 10, 2014

Installing docker 0.8 version on Centos 6.5

1. Configure EPEL Repository
[root@localhost ~]# sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: centos.aol.in
 * extras: centos.aol.in
 * updates: centos.aol.in
Setting up Install Process
epel-release-6-8.noarch.rpm                                                                    |  14 kB     00:00     
Examining /var/tmp/yum-root-7UK58w/epel-release-6-8.noarch.rpm: epel-release-6-8.noarch
Marking /var/tmp/yum-root-7UK58w/epel-release-6-8.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                     Arch                  Version              Repository                               Size
======================================================================================================================
Installing:
 epel-release                noarch                6-8                  /epel-release-6-8.noarch                 22 k

Transaction Summary
======================================================================================================================
Install       1 Package(s)

Total size: 22 k
Installed size: 22 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : epel-release-6-8.noarch                                                                            1/1 
  Verifying  : epel-release-6-8.noarch                                                                            1/1 

Installed:
  epel-release.noarch 0:6-8                                                                                           

Complete!

2. Install the docker-io package from EPEL Repository
[root@localhost ~]# yum install docker-io
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                                                                  | 4.6 kB     00:00     
 * base: centos.aol.in
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
epel                                                                                           | 4.2 kB     00:00     
epel/primary_db                                                                                | 5.9 MB     00:06     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:0.7.6-2.el6 will be installed
--> Processing Dependency: xz for package: docker-io-0.7.6-2.el6.x86_64
--> Processing Dependency: lxc for package: docker-io-0.7.6-2.el6.x86_64
--> Processing Dependency: libcgroup for package: docker-io-0.7.6-2.el6.x86_64
--> Running transaction check
---> Package libcgroup.x86_64 0:0.40.rc1-5.el6_5.1 will be installed
---> Package lxc.x86_64 0:0.9.0-2.el6 will be installed
--> Processing Dependency: liblxc.so.0()(64bit) for package: lxc-0.9.0-2.el6.x86_64
---> Package xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6 will be installed
--> Running transaction check
---> Package lxc-libs.x86_64 0:0.9.0-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                Arch                Version                                        Repository            Size
======================================================================================================================
Installing:
 docker-io              x86_64              0.7.6-2.el6                                    epel                 3.4 M
Installing for dependencies:
 libcgroup              x86_64              0.40.rc1-5.el6_5.1                             updates              125 k
 lxc                    x86_64              0.9.0-2.el6                                    epel                  78 k
 lxc-libs               x86_64              0.9.0-2.el6                                    epel                 116 k
 xz                     x86_64              4.999.9-0.3.beta.20091007git.el6               base                 137 k

Transaction Summary
======================================================================================================================
Install       5 Package(s)

Total download size: 3.9 M
Installed size: 19 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): docker-io-0.7.6-2.el6.x86_64.rpm                                                        | 3.4 MB     00:03     
(2/5): libcgroup-0.40.rc1-5.el6_5.1.x86_64.rpm                                                 | 125 kB     00:00     
(3/5): lxc-0.9.0-2.el6.x86_64.rpm                                                              |  78 kB     00:00     
(4/5): lxc-libs-0.9.0-2.el6.x86_64.rpm                                                         | 116 kB     00:00     
(5/5): xz-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm                                          | 137 kB     00:00     
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 858 kB/s | 3.9 MB     00:04     
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) 
 Package: epel-release-6-8.noarch (@/epel-release-6-8.noarch)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) 
 Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libcgroup-0.40.rc1-5.el6_5.1.x86_64                                                                1/5 
  Installing : xz-4.999.9-0.3.beta.20091007git.el6.x86_64                                                         2/5 
  Installing : lxc-libs-0.9.0-2.el6.x86_64                                                                        3/5 
  Installing : lxc-0.9.0-2.el6.x86_64                                                                             4/5 
  Installing : docker-io-0.7.6-2.el6.x86_64                                                                       5/5 
  Verifying  : lxc-libs-0.9.0-2.el6.x86_64                                                                        1/5 
  Verifying  : xz-4.999.9-0.3.beta.20091007git.el6.x86_64                                                         2/5 
  Verifying  : docker-io-0.7.6-2.el6.x86_64                                                                       3/5 
  Verifying  : libcgroup-0.40.rc1-5.el6_5.1.x86_64                                                                4/5 
  Verifying  : lxc-0.9.0-2.el6.x86_64                                                                             5/5 

Installed:
  docker-io.x86_64 0:0.7.6-2.el6                                                                                      

Dependency Installed:
  libcgroup.x86_64 0:0.40.rc1-5.el6_5.1             lxc.x86_64 0:0.9.0-2.el6      lxc-libs.x86_64 0:0.9.0-2.el6     
  xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6     

Complete!
[root@localhost ~]# 

3. For the brave, start the docker and see these warnings
[root@localhost ~]# docker -d &
[1] 1145
[root@localhost ~]# 2014/02/10 03:23:29 WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0.
[/var/lib/docker|c3648251] +job initapi()
[/var/lib/docker|c3648251.initapi()] Creating server

Docker will continue to run. But, better upgrade to kernel 3.8 or higher. 4. Configure the elrepo repository so that we can upgrade kernel to 3.8 or higher
[root@localhost ~]# yum install http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
Setting up Install Process
elrepo-release-6-5.el6.elrepo.noarch.rpm                                                       | 7.2 kB     00:00     
Examining /var/tmp/yum-root-7UK58w/elrepo-release-6-5.el6.elrepo.noarch.rpm: elrepo-release-6-5.el6.elrepo.noarch
Marking /var/tmp/yum-root-7UK58w/elrepo-release-6-5.el6.elrepo.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package elrepo-release.noarch 0:6-5.el6.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                 Arch            Version                 Repository                                      Size
======================================================================================================================
Installing:
 elrepo-release          noarch          6-5.el6.elrepo          /elrepo-release-6-5.el6.elrepo.noarch          2.8 k

Transaction Summary
======================================================================================================================
Install       1 Package(s)

Total size: 2.8 k
Installed size: 2.8 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : elrepo-release-6-5.el6.elrepo.noarch                                                               1/1 
  Verifying  : elrepo-release-6-5.el6.elrepo.noarch                                                               1/1 

Installed:
  elrepo-release.noarch 0:6-5.el6.elrepo                                                                              

Complete!
5. Install the kernel-ml from elrepo
[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-ml
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * elrepo: mirror.smartmedia.net.id
 * elrepo-kernel: mirror.smartmedia.net.id
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
elrepo                                                                                         | 2.9 kB     00:00     
elrepo/primary_db                                                                              | 593 kB     00:02     
elrepo-kernel                                                                                  | 2.9 kB     00:00     
elrepo-kernel/primary_db                                                                       |  19 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-ml.x86_64 0:3.13.2-1.el6.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                  Arch                  Version                            Repository                    Size
======================================================================================================================
Installing:
 kernel-ml                x86_64                3.13.2-1.el6.elrepo                elrepo-kernel                 35 M

Transaction Summary
======================================================================================================================
Install       1 Package(s)

Total download size: 35 M
Installed size: 159 M
Is this ok [y/N]: y
Downloading Packages:
kernel-ml-3.13.2-1.el6.elrepo.x86_64.rpm                                                       |  35 MB     02:21     
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
Importing GPG key 0xBAADAE52:
 Userid : elrepo.org (RPM Signing Key for elrepo.org) 
 Package: elrepo-release-6-5.el6.elrepo.noarch (@/elrepo-release-6-5.el6.elrepo.noarch)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kernel-ml-3.13.2-1.el6.elrepo.x86_64                                                               1/1 
  Verifying  : kernel-ml-3.13.2-1.el6.elrepo.x86_64                                                               1/1 

Installed:
  kernel-ml.x86_64 0:3.13.2-1.el6.elrepo                                                                              

Complete!
[root@localhost ~]# 
6. Reboot the server into the 3.13 kernel (MAKE SURE TO SELECT KERNEL IN GRUB MENU)
[root@localhost ~]# reboot

Broadcast message from root@localhost.localdomain
        (/dev/pts/0) at 3:33 ...

The system is going down for reboot NOW!

7. Login and verify the server kernel version
[root@localhost ~]# uname -r
3.13.2-1.el6.elrepo.x86_64
[root@localhost ~]# 

8. See that a new docker0 interface is created
[root@localhost ~]# ifconfig
docker0   Link encap:Ethernet  HWaddr A2:FA:1E:55:53:77  
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::a0fa:1eff:fe55:5377/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:1422 (1.3 KiB)

eth0      Link encap:Ethernet  HWaddr 08:00:27:D5:BC:A0  
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fed5:bca0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:118 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:13818 (13.4 KiB)  TX bytes:7215 (7.0 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@localhost ~]# 

9. Start the docker in daemon mode
[root@localhost ~]# docker -d
10. Verify the docker version
[root@localhost ~]# docker version
Client version: 0.7.6
Go version (client): go1.2
Git commit (client): bc3b2ec/0.7.6
Server version: 0.7.6
Git commit (server): bc3b2ec/0.7.6
Go version (server): go1.2
Last stable version: 0.8.0, please update docker
[root@localhost ~]# 

11. Update to 0.8 version (Optional Step)
[root@localhost ~]# ps auxww | grep docker
root      1008  0.0  1.3 338992  6788 ?        Sl   03:35   0:00 /usr/bin/docker -d
root      1357  0.0  0.1 103296   820 pts/0    S+   03:55   0:00 grep docker
[root@localhost ~]# kill -9 1008

[root@localhost ~]# yum install http://kojipkgs.fedoraproject.org//packages/docker-io/0.8.0/2.el6/x86_64/docker-io-0.8.0-2.el6.x86_64.rpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * elrepo: mirror.smartmedia.net.id
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
Setting up Install Process
docker-io-0.8.0-2.el6.x86_64.rpm                                                               | 3.6 MB     00:05     
Examining /var/tmp/yum-root-7UK58w/docker-io-0.8.0-2.el6.x86_64.rpm: docker-io-0.8.0-2.el6.x86_64
Marking /var/tmp/yum-root-7UK58w/docker-io-0.8.0-2.el6.x86_64.rpm as an update to docker-io-0.7.6-2.el6.x86_64
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:0.7.6-2.el6 will be updated
---> Package docker-io.x86_64 0:0.8.0-2.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                Arch                Version                  Repository                                  Size
======================================================================================================================
Updating:
 docker-io              x86_64              0.8.0-2.el6              /docker-io-0.8.0-2.el6.x86_64               19 M

Transaction Summary
======================================================================================================================
Upgrade       1 Package(s)

Total size: 19 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : docker-io-0.8.0-2.el6.x86_64                                                                       1/2 
  Cleanup    : docker-io-0.7.6-2.el6.x86_64                                                                       2/2 
  Verifying  : docker-io-0.8.0-2.el6.x86_64                                                                       1/2 
  Verifying  : docker-io-0.7.6-2.el6.x86_64                                                                       2/2 

Updated:
  docker-io.x86_64 0:0.8.0-2.el6                                                                                      

Complete!

[root@localhost ~]# docker info
Containers: 0
Images: 0
Driver: devicemapper
 Pool Name: docker-253:0-110-pool
 Data file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 291.5 Mb
 Data Space Total: 102400.0 Mb
 Metadata Space Used: 0.7 Mb
 Metadata Space Total: 2048.0 Mb
WARNING: No swap limit support
[root@localhost ~]# 

Go to http://docs.docker.io/en/latest/ and get started with docker.

Have Fun !

NOTE: If you were use http://www.hop5.in repository. Dont worry as the package upgrades are seamless due to the package name being same.

9 comments:

  1. Hey Naresh -- thanks for the post! However, I do have a question -- after installing the 3.13 kernel I did a lxc-checkconfig and noticed that User Namespaces was missing . Is this a problem? If so, any idea how to fix / enable it? Also how about the No Swap Limit support missing? Cheers!

    ReplyDelete
    Replies
    1. Hi Steve,

      Some of the features are optional. See http://docs.docker.io/en/latest/installation/kernel/

      Use these commands to check your active kernel has the things compiled as module/built-in

      nareshv localhost ~ $ egrep '^CONFIG_(BRIDGE|NETFILTER_XT_MATCH_ADDRTYPE|NF_NAT|NF_NAT_IPV4|NF_NAT_NEEDED)=' /boot/config-$(uname -r) | nl
      1 CONFIG_NF_NAT=m
      2 CONFIG_NF_NAT_NEEDED=y
      3 CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
      4 CONFIG_NF_NAT_IPV4=m
      5 CONFIG_BRIDGE=m

      nareshv localhost ~ $ egrep '^CONFIG_(BLK_DEV_DM|DM_THIN_PROVISIONING|EXT4_FS)=' /boot/config-$(uname -r) | nl
      1 CONFIG_BLK_DEV_DM=y
      2 CONFIG_DM_THIN_PROVISIONING=m
      3 CONFIG_EXT4_FS=y

      nareshv localhost ~ $ egrep '^CONFIG_(NAMESPACES|UTC_NS|IPC_NS|UID_NS|PID_NS|NET_NS)=' /boot/config-$(uname -r) | nl
      1 CONFIG_NAMESPACES=y
      2 CONFIG_IPC_NS=y
      3 CONFIG_PID_NS=y
      4 CONFIG_NET_NS=y

      nareshv localhost ~ $ egrep '^CONFIG_(NAMESPACES|UTC_NS|IPC_NS|UID_NS|PID_NS|NET_NS)' /boot/config-$(uname -r) | nl
      1 CONFIG_NAMESPACES=y
      2 CONFIG_IPC_NS=y
      3 CONFIG_PID_NS=y
      4 CONFIG_NET_NS=y

      nareshv localhost ~ $ egrep '^CONFIG_(CGROUPS)=' /boot/config-$(uname -r) | nl
      1 CONFIG_CGROUPS=y

      nareshv localhost ~ $ egrep '^CONFIG_(CGROUP_CPUACCT|BLK_CGROUP|MEMCG|MEMCG_SWAP)=' /boot/config-$(uname -r) | nl
      1 CONFIG_CGROUP_CPUACCT=y
      2 CONFIG_MEMCG=y
      3 CONFIG_MEMCG_SWAP=y
      4 CONFIG_BLK_CGROUP=y

      Have fun!

      Delete
  2. No way, when I reboot I continue to have the old kernel "2.6.32-358.2.1.el6.x86_64" :(

    ReplyDelete
    Replies
    1. Pablo, I assume you have selected the kernel in the grub menu, while booting. That should take care of it.

      Delete
  3. Hi, i'm trying to setup docker to use my hosts network. I'm a little confused at how this is done. I've tried creating the br0 and giving the the IP address of eth0 and putting statements in eth0 to look for this new device. But it never seems to work right. Any help?

    ReplyDelete
  4. Andrew, could you see this detailed blog post ? http://jpetazzo.github.io/2013/10/16/configure-docker-bridge-network/

    ReplyDelete