安装静态二进制文件
参考地址: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版本有关的文件。
本文章下载为:docker-19.03.5.tgz 注意要跟据平台硬件下载以免造成不兼容
将下载好的文件上传到服务器
解压文件
tar xzvf docker-19.03.5.tgz
将二进制文件移到可执行路径上的目录,例如/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