第十四章 Centos7下二进制安装Docker-20.10.9


各个版本Docker地址:https://download.docker.com/linux/static/stable/x86_64/

一、下载安装包

#1.进入软件下载目录,下载Docker-20.10.9安装包
[root@staging ~]# cd /data/software/
[root@staging software]# wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz

#2.查看下载的安装包
[root@staging software]# ll -h
total 17G
-rw-r--r--  1 root root  61M Oct 25 16:19 docker-20.10.9.tgz

二、解压安装包

#1.解压安装包到/data2目录下
[root@staging software]# tar xf docker-20.10.9.tgz  -C /data2/
[root@staging software]# cd /data2

#2.重命名docker目录
[root@staging data2]# mv docker docker-20.10.9

三、做软连接

[root@staging data2]# ln -s docker-20.10.9 docker
[root@staging data2]# ll
total 14515840
lrwxrwxrwx  1 root root          14 Oct 27 11:27 docker -> docker-20.10.9
drwxrwxr-x  2 root root         169 Oct  5 00:08 docker-20.10.9

四、配置环境变量

[root@staging docker]# vi /etc/profile.d/docker.sh 
export PATH=/data2/docker:$PATH

[root@staging docker]# source /etc/profile.d/docker.sh 

五、配置system启动

[root@staging docker]# vi /usr/lib/systemd/system/docker_new.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
ExecStart=/data2/docker/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
 
[Install]
WantedBy=multi-user.target

六、启动dockerd服务进程

[root@staging docker]# systemctl daemon-reload

[root@staging docker]# systemctl  enable  --now docker_new.service

七、验证Docker服务

[root@staging ~]# docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
  scan: Docker Scan (Docker Inc., v0.9.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.9
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.15.2.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.47GiB
 Name: staging
 ID: YYU2:DJRP:A2PK:CS2C:MMCJ:FSXI:Y6F5:OQKI:NWWE:6BQB:JZZC:YOD6
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false