CentOS and RedHat 6.5 install Docker offline

  • 2020-06-01 11:22:45
  • OfStack

instructions

1. As it is an offline download, you need to download the required dependent packages in advance

2. The version used is Centos 6.5

3. Not upgrading the kernel

The installation process

1. Download dependent packages (using nodes that can be connected to the Internet)

Skip this step when the dependency package has been downloaded
Use nodes that have a network

1. Install the downloadonly plug-in and download the rpm package using yum

# yum install yum-plugin-downloadonly

Usage:

yum install --downloadonly (download only not install) --downloaddir= the name of the component installed in the directory where the rpm package was downloaded

2. Download the dependencies required by docker

2.1 configure the Fedora EPEL source

# yum install http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

2.2 add hop5.repo source


# cd /etc/yum.repos.d 
# wget http://www.hop5.in/yum/el6/hop5.repo

2.3 download dependent packages


# mkdir /usr/local/docker
# yum install --downloadonly --downloaddir=/usr/local/docker docker-io

This step will report an error and the rpm package will not be found. The reason is that the version number of the corresponding rpm package has changed. Copy the package name of the undownloaded rpm package (without version number) and enter the following website:

http://mirrors.aliyun.com/epel/6/x86_64/

Find the rpm package with the corresponding package name, for example, lxc-1.0.8-1.el6.x86_64.rpm package download failed, please find lxc-1.0.9 - in the above website

1. el6. x86_64 rpm, copy the link address, http: / / mirrors aliyun. com epel / 6 / x86_64 / lxc - 1.0.9-1. el6. x86_64. rpm


# cd /usr/local/docker
# wget http://mirrors.aliyun.com/epel/6/x86_64/lxc-1.0.9-1.el6.x86_64.rpm

You can download the corresponding package

2.4 download device-mapper-libs and launch docker without downloading will report an error


# mkdir /usr/local/docker/device-mapper-libs
# yum install --downloadonly --downloaddir=/usr/local/docker/device-mapper-libs device-mapper-libs

2.5 copy the entire docker directory to the /usr/local/src directory on the offline node where docker needs to be installed

2. Install docker (offline node)

1. Install docker


# cd /usr/local/src/docker
# rpm -ivh lxc-libs-1.0.9-1.el6.x86_64.rpm
# rpm -ivh lua-alt-getopt-0.7.0-1.el6.noarch.rpm
# rpm -ivh lua-filesystem-1.4.2-1.el6.x86_64.rpm
# rpm -ivh lua-lxc-1.0.9-1.el6.x86_64.rpm  
# rpm -ivh lxc-1.0.9-1.el6.x86_64.rpm  
# rpm -ivh docker-io-1.7.1-2.el6.x86_64.rpm

2. Run the docker-d command and error is reported as follows:

docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference

2.1 solutions:


# cd /usr/local/src/docker/device-mapper-libs
# yum -y install device-mapper*

3. Run the docker-d command again and report the following error:

FATA[0000] Error mounting devices cgroup: mountpoint for devices not found

3.1 solutions are as follows:


# vi /etc/fstab
# Add at the end 
none    /sys/fs/cgroup    cgroup    defaults  0  0

# restart 
# reboot

4. Run docker-d again; Put it in the background


# mkidr /usr/local/docker
# cd /usr/local/docker
# nohup docker -d &
# tail -f nohup.out

If there is no error message, the installation is successful!


Related articles: