Build docker environment under Centos6.5

  1. To run docker Linux kernel version needs to be above 3.8. For systems with centos6.5 kernel 2.6, you need to upgrade the kernel first. Otherwise, you will get stuck and exit the container.

In yum's ELRepo source, there are two kernel versions: mainline (3.13.1) and long-term (3.10.28). Considering that long-term is more stable and will be updated for a long time, this version is chosen.

  1. View the current version:
[ root@localhost ~]# more /etc/issue
CentOS release 6.5(Final)
Kernel \r on an \m
[ root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 2203:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
  1. Upgrade kernel to 3.10.28

1.> Import public key

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

2.> Install ELRepo into CentOS-6.5

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

3.> Install kernel-lt (lt=long-term)

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

Or install kernel-ml (ml=mainline)

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

4.> Edit the grub.conf file to modify the Grub boot order

vim /etc/grub.conf

# 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

Confirm where the newly installed kernel is, and then set the default value (starting from 0). Generally, the newly installed kernel is in the first position, so set default=0

5.> Restart and check the kernel version number.

[ root@localhost ~]# reboot
[ root@localhost ~]# uname -r
3.10.104- 1. el6.elrepo.x86_64

At this point, the kernel upgrade of CentOS6.5 is complete, and docker can be installed below.

  1. Install docker

Use the command directly: yum install docker-io will report an error!!! Tip: No package docker-io available.

You need to install the yum source first.

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

Execute again

yum install docker-io

You can install it normally!!

During the installation process, an error was reported due to dns problems, so you must set up your own dns to ensure that the server can connect to the external network. The dns I set at the time was:

vim /etc/resolv.conf 
nameserver 8.8.8.8
nameserver 8.8.4.4

Start docker

service docker start

Check the docker version:

[ root@localhost ]# 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

Check the docker log.

cat /var/log/docker

At this point, the docker installation is complete! ! !

Three, uninstall docker

List the packages you have installed

[ root@localhost ~]# yum list installed | grep docker
docker-io.x86_64                     1.7.1-2.el6                        @epel

Remove package

yum -y remove docker-io.x86_64

Delete images/containers, etc.

rm -rf /var/lib/docker

Fourth, upgrade the docker version to 1.10.3

Stop the docker service before upgrading and back up the original docker service. mv /usr/bin/docker /usr/bin/docker.bak

nohup wget -c https://get.docker.com/builds/Linux/x86_64/docker-1.10.3-O /usr/bin/docker

Give execution permission: chmod 755 /usr/bin/docker and then restart the service and check the version.

Recommended Posts

Build docker environment under Centos6.5
CentOS6.7 build LNMP environment
Centos7.6 build LNMP environment
[PHP] Build a PHP operating environment under CentOS
CentOS 7 build LNMP environment
Build Discuz Forum in LNMP Environment under CentOS7
Build LEMP (Linux+Nginx+MySQL+PHP) environment under CentOS 8.1 (detailed tutorial)
Build Dedecms website in LNMP environment under CentOS7
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Build OpenV** Server under CentOS7
Build OpenLDAP server under CentOS7
CentOS environment installation of Docker
Build a basic environment for Java development under Centos7
Build a PXC cluster under CentOS8
Build an FTP server under centos7
Build Elasticsearch 6.2.4 (centos) based on docker
Install and use docker under CentOS 6.8
Build Nginx environment on Linux (CentOS)
FFmpeg environment deployment record under centos7
PPTP environment deployment record under Centos
CentOS 7 install Docker
CentOS7 install Docker
Build the C++ compilation environment under ubuntu
CentOS7 build jenkins
Docker installation (CentOS7 installation)
Centos build lnmp
Centos7 build python3.8.5+scrapy+gerapy
(1) Centos7 installation to build a cluster environment
Centos7 install Docker
Centos7 install docker18
centos7 install docker
CentOS7 docker installation
Build a python development environment under Ubuntu
CentOS 6 install Docker
Docker learning 2- quickly build a centos7-python3.6 environment
Centos8 install Docker
Install Docker CE in yum under CentOS 7
Build a ScaleIO distributed storage cluster under CentOS7
How to quickly build Nginx server under CentOS
How to build a LAMP environment on centos7.2
CentOS7.3 64 bit, build Zabbix3.4
Install Docker on Centos7
CentOS build private git
Deploy GitBook under CentOS7
Linux (centos7) build gitlab
Build k8s1.9.9 on centos7
Compile Hadoop-2.7.6 under CentOS7.4
Centos6.9 build rabbitmq 3.6.8 cluster
CentOS 7 install Docker service
Install mysql5.7 under CentOS7
Hadoop environment construction (centos7)
Install ActiveMQ under Centos7
lamp (centos7) installation lamp environment
Install PostgreSQL12 under CentOS7
Install CentOS under VMware
Centos7 build Kubernetes cluster
Centos6.9 install npm environment
CentOS 8.0 installs docker error
Jenkins build on centos
Deploy JDK+Tomcat8 under CentOS
Install mysql under Centos 7