安裝靜態二進制文件
參考地址:https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries
下載靜態二進制存檔。轉到 https://download.docker.com/linux/static/stable/ (或更改stable
為nightly
或test
),選擇您的硬件平台,然后下載.tgz
與您要安裝的Docker Engine-Community版本有關的文件。

20191225111345.png
本文章下載為:docker-19.03.5.tgz 注意要跟據平台硬件下載以免造成不兼容
將下載好的文件上傳到服務器

20191225111836.png
解壓文件
tar xzvf docker-19.03.5.tgz

20191225112103.png
將二進制文件移到可執行路徑上的目錄,例如/usr/bin/
sudo cp docker/* /usr/bin/
配置 docker.service文件
vi /usr/lib/systemd/system/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 ExecStart=/usr/bin/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服務進程
systemctl daemon-reload
systemctl start docker.service
查看docker 安裝信息
docker info
Client: Debug Mode: false Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 19.03.5 Storage Driver: overlay2 Backing Filesystem: xfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs 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: runc Default Runtime: runc Init Binary: docker-init containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 3.10.0-957.el7.x86_64 Operating System: Red Hat Enterprise Linux Server 7.6 (Maipo) OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 1.795GiB Name: localhost.localdomain ID: AV7D:WG7N:CATA:5SOR:IDCS:OPLA:QXVN:5Z3E:P6BH:5YHL:3IMT:FGLP 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 Product License: Community Engine
開機自動啟動
sudo systemctl enable docker
由於我們是在無網絡狀態下安裝的docker 容器所以我們也需要下載相關的鏡像進行試運行
使用有網服務器下載好鏡像
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql 5.5 d404d78aa797 7 months ago 205MB
保存
docker save d404d78aa797 > mysql5.tar
查看保存的tar
[root@localhost ynxx]# ls mysql5.tar
將此鏡像上傳到所需安裝的服務器中
導入鏡像
mysql5.tar 為需導入的鏡像
[root