Docker requires a Linux kernel version of 3.8 or higher, you must check the kernel version of the host operating system before installation. Otherwise, if the kernel is lower than 3.8, Docker can be successfully installed, but after entering Docker, it will automatically exit. .
1. Download and install CentOS 6.9
CentOS 6 series, the latest version is 6.9, because Docker can only run on 64-bit systems, so select an image download CentOS 6.9 64-bit CentOS official website
2, upgrade CentOS Linux kernel
CentOS 6.9 default linux kernel version is 2.6, CentOS 7 default linux kernel version is 3.10, so for CentOS 6.9 you need to upgrade the kernel version
1) Enter the URL of the updated linux kernel http://elrepo.org/tiki/tiki-index.php
2) Follow the instructions to update the kernel and execute the following command in the root account
(1) import public key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
(2) Install ELRepo
For Centos 6,
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 the kernel
Long-term supported version, stable (recommended)
yum --enablerepo=elrepo-kernel install -y kernel-lt
Mainline version (mainline)
yum --enablerepo=elrepo-kernel install -y kernel-ml
(4) modify the Grub boot sequence, set the default startup of the newly upgraded kernel
Edit grub.conf file
vi /etc/grub.conf
Modify default to the location of the newly installed kernel
# grub.conf generated by anaconda
#
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title 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=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-3.10.28-1.el6.elrepo.x86_64.img
title 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, kernel upgrade completed
reboot
3, install docker
(1) disable selinux
Because selinux and LXC have conflicts, selinux is disabled
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 Fedora EPEL source
Because Docker 6.x and 7.x installation docker is a little different, the docker installation package for CentOS 6.x is called docker-io, which comes from the Fedora epel library. This repository maintains a large number of packages that are not included in the distribution. Software, so first install EPEL, and docker for CentOS 7.x is directly included in the Extras repository of the official image source (the [extras] section enable=1 enable under 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) Check Docker Version
docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64
(6) Perform docker hello-world
Pull 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 bash
For more examples and ideas, visit:
http://docs.docker.com/userguide/
The above output message indicates that Docker has been completely installed
4, uninstall Docker
If you want to uninstall docker, it is very simple, check the docker installation package
yum list installed | grep docker
Then delete the installation package
yum -y remove docker-io.x86_64
Delete a mirror or container
rm -rf /var/lib/docker
Recent Comments