catalogue
2. Installing docker without network rpm:
(3) Upload offline rpm package:
(4) Execute the installation package:
(5) Write the docker service script:
(6) Upload service script and authorization:
1. View kernel:
The official documentation requires that the Linux kernel must be at least 3.8, and docker can only run on 64 bit systems. Since the kernel versions of RHEL6 and CentOS6 are 2.6, you must upgrade the kernel first. CentOS 7 and above are recommended.
Execute the command to view the kernel: uname -r
The Centos6 kernel is as follows:
The Centos7 kernel is as follows:
2. Installing docker without network rpm:
Execute the yum command on a server with a network and no docker installed, and download the required installation package in rpm format to the specified folder of the server, so as to install it in a server without a network:
(1) Close selinux:
Edit the / etc/selinux/config file. Then restart the server.
(2) Get offline rpm package:
Create rpm software storage directory:
mkdir -p /wocloud/soft/docker_rpm
Install rpm dependent packages:
yum install -y yum-utils device-mapper-persistent-data lvm2
To configure a repository:
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Get the rpm package of docker:
yum -y install docker-ce-18.06.1.ce-3.el7 --downloadonly --downloaddir /wocloud/soft/docker_rpm
When other netless servers need to be installed, use / wocloud / soft / docker_ Compress all rpm files in rpm into a package, upload them to the target server, and execute the following installation command.
Offline rpm and registered system service file resource address of docker-18.06.1:
(3) Upload offline rpm package:
Upload the obtained rpm offline package of docker to the target server.
(4) Execute the installation package:
Enter the folder of rpm offline package in docker and execute the following installation command:
Execute command:
rpm -ivh *.rpm --force --nodeps
(5) Write the docker service script:
Prepare docker.service service file;
[Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process # restart the docker process if it exits prematurely Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target
(6) Upload service script and authorization:
Upload the docker.service file to the server / etc/systemd/system / and authorize:
chmod 777 /etc/systemd/system/docker.service
(7) Reload system services:
Because docker.service is added, the system needs to reload the configuration file. Execute the command: systemctl daemon reload
3. Auto start docker service:
Execute the command to add docker service since startup:
systemctl enable docker
4. Start docker service:
Execute the command to start docker service:
systemctl start docker
5. Close docker service:
Execute the command to close docker service:
systemctl stop docker
6. View docker service:
Execute the command to view docker service:
systemctl status docker
7. View docker version:
Execute the command to view docker version:
docker version