Container - linux netless installation docker

Posted by stevepatd on Fri, 11 Feb 2022 05:28:21 +0100

Catalog

1. View the Kernel:

2. Install docker without network:

(1) Turn off selinux:

(2) Download the package:

(3) Upload software package:

(4) Decompression package:

(5) Move files:

(6) Script docker services:

(7) Upload service scripts and authorizations:

(8) System reload profile:

3. Start-up self-docker service:

4. Start the docker service:

5. Turn off the docker service:

6. View docker services:

7. View the docker version:

1. View the Kernel:

Official documentation requires Linux kernel s to be at least 3.8 and docker s to only run on 64-bit systems. Since the kernel versions of RHEL6 and entOS 6 are 2.6, you must upgrade the kernel first. centos7 and above is recommended.

Execute the command to view the kernel: uname -r

The Centos6 kernel is as follows:

The Centos7 kernel is as follows:

2. Install docker without network:

(1) Turn off selinux:

Edit the/etc/selinux/config file. Then restart the server.

(2) Download the package:

Software download address: https://download.docker.com/linux/static/stable/

Choose the version you want, the ce version is the community version (free), and the ee version is the commercial version (paid).

(3) Upload software package:

Upload the downloaded package to the folder specified in the server.

(4) Decompression package:

Unzip the package in the server specified folder.

(5) Move files:

Move all files from the decompressed docker to/usr/bin/

(6) Script docker services:

Write docker.service service file;

docker.service



[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

(7) Upload service scripts and authorizations:

Will docker.service file uploaded to server/etc/systemd/system/with authorization: Chmod 777/etc/systemd/system/docker.service

(8) System reload profile:

Thanks to the addition of docker.service, so you need to have the system reload the configuration file. Execute command: systemctl daemon-reload

3. Start-up self-docker service:

Execute the Start Up Add docker service command:

systemctl enable docker

4. Start the docker service:

Execute the Start docker service command:

systemctl start docker

5. Turn off the docker service:

Execute the close docker service command:

systemctl stop docker

6. View docker services:

Execute the View docker service command:

systemctl status docker

7. View the docker version:

Execute the View docker version command:

docker version

Topics: Docker Container