sábado, 15 de outubro de 2016

Installing Docker on CentOs 6

1. Introduction

This post shows how to install "Docker" on a CentOS 6.x system.


2. Step-by-Step

2.1. Check if processosr suports Docker

  • Docker does not support 32 bits processors
  • Docker is supported by Kernel 3.8 or higher


[root@localhost install-docker]# uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost install-docker]#


2.2. Install Docker using official scripts from official 

[root@localhost ~]# mkdir install-docker
[root@localhost ~]# cd install-docker/
[root@localhost install-docker]# wget -qO- https://get.docker.com | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'

warning: rpmts_HdrFromFdno: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY
Importing GPG key 0x2C52609D:
 Userid: "Docker Release Tool (releasedocker) <docker@docker.com>"
 From  : https://yum.dockerproject.org/gpg

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

[root@localhost install-docker]#


2.3. Start Docker service and configure to startup

[root@localhost install-docker]# service docker status
docker is stopped
[root@localhost install-docker]# service docker start
Starting cgconfig service:                                 [  OK  ]

Starting docker:                                           [  OK  ]

[root@localhost install-docker]# chkconfig docker



2.4. Using Docker basic commands

  • Docker version
[root@localhost install-docker]# docker --version
Docker version 1.7.1, build 786b29d



  • Is there any container running? And what about created containger but not running?
[root@localhost install-docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost install-docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost install-docker]#


  • Searching images from containers of 'centos' and 'debian'
[root@localhost install-docker]# docker search centos
NAME                            DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                          The official build of CentOS.                   2733      [OK]
ansible/centos7-ansible         Ansible on Centos7                              89                   [OK]
jdeathe/centos-ssh              CentOS-6 6.8 x86_64 / CentOS-7 7.2.1511 x8...   41                   [OK]
jdeathe/centos-ssh-apache-php   CentOS-6 6.8 x86_64 / Apache / PHP / PHP M...   21                   [OK]
nimmis/java-centos              This is docker images of CentOS 7 with dif...   16                   [OK]
million12/centos-supervisor     Base CentOS-7 with supervisord launcher, h...   12                   [OK]
gluster/gluster-centos          Official GlusterFS Image [ CentOS7 +  Glus...   12                   [OK]
torusware/speedus-centos        Always updated official CentOS docker imag...   8                    [OK]
nickistre/centos-lamp           LAMP on centos setup                            7                    [OK]
kinogmt/centos-ssh              CentOS with SSH                                 6                    [OK]
nathonfowlie/centos-jre         Latest CentOS image with the JRE pre-insta...   4                    [OK]
centos/mariadb55-centos7                                                        3                    [OK]
consol/sakuli-centos-xfce       Sakuli end-2-end testing and monitoring co...   2                    [OK]
centos/tools                    Docker image that has systems administrati...   2                    [OK]
timhughes/centos                Centos with systemd installed and running       1                    [OK]
harisekhon/centos-java          Java on CentOS (OpenJDK, tags jre/jdk7-8)       1                    [OK]
harisekhon/centos-scala         Scala + CentOS (OpenJDK tags 2.10-jre7 - 2...   1                    [OK]
darksheer/centos                Base Centos Image -- Updated hourly             1                    [OK]
centos/redis                    Redis built for CentOS                          1                    [OK]
blacklabelops/centos            CentOS Base Image! Built and Updates Daily!     1                    [OK]
grayzone/centos                 auto build for centos.                          0                    [OK]
repositoryjp/centos             Docker Image for CentOS.                        0                    [OK]
smartentry/centos               centos with smartentry                          0                    [OK]
ustclug/centos                   USTC centos                                    0                    [OK]
januswel/centos                 yum update-ed CentOS image                      0                    [OK]
[root@localhost install-docker]#
[root@localhost install-docker]#
[root@localhost install-docker]#
[root@localhost install-docker]# docker search debian
NAME                           DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
debian                         Debian is a Linux distribution that's comp...   1724      [OK]
neurodebian                    NeuroDebian provides neuroscience research...   29        [OK]
jesselang/debian-vagrant       Stock Debian Images made Vagrant-friendly ...   9                    [OK]
armbuild/debian                ARMHF port of debian                            8                    [OK]
eboraas/debian                 Debian base images, for all currently-avai...   6                    [OK]
frekele/debian                 docker run --rm --name debian frekele/debian    2                    [OK]
reinblau/debian                Debian with usefully default packages for ...   2                    [OK]
datenbetrieb/debian            minor adaption of official upstream debian...   1                    [OK]
1maa/debian                    Debian base image                               1                    [OK]
servivum/debian                Debian Docker Base Image with Useful Tools      1                    [OK]
maxexcloo/debian               Base image built on Debian with init, Supe...   1                    [OK]
lephare/debian                 Base debian images                              1                    [OK]
webhippie/debian               Docker images for debian                        1                    [OK]
eeacms/debian                  Docker image for Debian to be used with EE...   1                    [OK]
lucasbarros/debian             Basic image based on Debian                     1                    [OK]
smartentry/debian              debian with smartentry                          0                    [OK]
konstruktoid/debian            Debian base image                               0                    [OK]
mariorez/debian                Debian Containers for PHP Projects              0                    [OK]
fike/debian                    Debian Images with language locale installed.   0                    [OK]
vcatechnology/debian           A Debian image that is updated daily            0                    [OK]
visono/debian                  Docker base image of debian 7 with tools i...   0                    [OK]
nimmis/debian                  This is different version of Debian with a...   0                    [OK]
icedream/debian-jenkinsslave   Debian for Jenkins to be used as slaves.        0                    [OK]
ustclug/debian                 debian image for docker with rustic mirror      0                    [OK]
pl31/debian                    Debian base image.                              0                    [OK]



  • My first containers
Run ( launch ) your 'debian' container, and at first update your SO (this may takes a while on first time you run this image), check your IP, and exit or loggof or ctrl+d. Notice that when you exit container, this does not exist anymore!!! 





3. References