Install Docker in CentOS 6.9

Source: Internet
Author: User
Tags how to install docker on ubuntu docker hub

Install Docker in CentOS 6.9

Because Docker requires that the Linux kernel version be 3.8 or later, check the kernel version of the host machine operating system before installation. Otherwise, if the kernel is lower than 3.8, Docker can be installed successfully, but it will automatically exit after entering Docker.

1. Download and install CentOS 6.9.

CentOS 6 series, the latest version is 6.9. Since Docker can only run on 64-bit systems, select an image on the CentOS official website to download CentOS 6.9 64-bit

2. Upgrade CentOS Linux Kernel

CentOS 6.9 uses the default Linux kernel version 2.6 and CentOS 7 uses the default Linux kernel version 3.10. Therefore, CentOS 6.9 requires kernel version upgrade.

1) Go to update the Linux kernel web site http://elrepo.org/tiki/tiki-index.php

2) Update the kernel according to the operation instructions and execute the following commands under the root account:

(1) Import public key

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

(2) install ELRepo

For Centos6,

rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm

For Cenos7,

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (external link)

(3) install kernel

Long-term supported versions, stable (recommended)

yum --enablerepo=elrepo-kernel install -y kernel-lt

Main Line version (mainline)

yum --enablerepo=elrepo-kernel install -y kernel-ml

(4) modify the Grub boot sequence and set the new kernel to be started by default.

Edit the grub. conf file

vi /etc/grub.conf

Change default to the new kernel installation location

# Grub. conf generated by anaconda # default = 0 # generally, the latest installed kernel is in the first position and changed to 0 timeout = 5 splashimage = (hd0, 0) /boot/grub/splash.xpm.gz hiddenmenutitle CentOS (3.10.28-1. el6.elrepo. x86_64) root (hd0, 0) kernel/boot/vmlinuz-3.10.28-1.el6.elrepo.x86_64 ro root = UUID = export rd_NO_LUKS KEYBOARDTYPE = pc KEYTABLE = us rd_NO_MD crashkernel = auto. UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet initrd/boot/initramfs-3.10.28-1.el6.elrepo.x86_64.imgtitle CentOS (2.6.32-431.3.1.el6.x86 _ 64) root (hd0, 0) kernel/boot/vmlinuz-2.6.32-431.3.1.el6.x86_64 ro root = UUID = 0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE = pc KEYTABLE = us rd_NO_MD crashkernel = auto. UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet initrd/boot/initramfs-2.6.32-431.3.1.el6.x86_64.img

(5) restart and kernel upgrade complete

reboot

3. Install docker

(1) Disable selinux

Selinux is disabled because selinux conflicts with LXC.

vi /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

(2) configure the Fedora EPEL Source

Because CentOS 6. x and 7. x docker installation is somewhat different, CentOS 6. the docker installation package on x is called docker-io and comes from the Fedora epel library. This warehouse maintains a large number of software not included in the release version. Therefore, you must install EPEL first, while CentOS 7. x's docker is directly included in the Extras repository of the official image source ([extras] section enable = 1 under the CentOS-Base.repo)

yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

(3) install docker

Install docker-io

yum install -y docker-io

(4) Start docker

service docker start

(5) view the docker version

docker version
Client version: 1.7.1Client API version: 1.19Go version (client): go1.4.2Git commit (client): 786b29d/1.7.1OS/Arch (client): linux/amd64Server version: 1.7.1Server API version: 1.19Go version (server): go1.4.2Git commit (server): 786b29d/1.7.1OS/Arch (server): linux/amd64

(6) Run docker hello-world

Pull a hello-world Image

docker pull hello-world

Run hello-world

docker run hello-world
Hello from Docker.This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.    (Assuming it was not already locally available.) 3. The Docker daemon created a new container from that image which runs the    executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it    to your terminal.To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bashFor more examples and ideas, visit: http://docs.docker.com/userguide/

The above output indicates that Docker has been fully installed successfully.

4. Uninstall docker

It is also very easy to uninstall docker. Check the docker installation package.

yum list installed | grep docker

Then delete the installation package

yum -y remove docker-io.x86_64

Delete an image or container

rm -rf /var/lib/docker

For more Docker tutorials, see the following:

Docker installation application (CentOS 6.5_x64)

Configure Docker on Ubuntu 16.04 Server

Install Docker in Ubuntu 15.04

Docker installation instance

Create a basic image using Docker

How to install Docker on Ubuntu 15.04 and its basic usage

Docker usage notes on Ubuntu 16.04

Use Docker to start common applications in minutes

Solution for changing the configuration file of Docker in Ubuntu 16.04 does not take effect

Docker details: click here
Docker: click here

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.