Docker最理想的安装方式-离线安装

1、去官网下载docker 安装二进制包,选择适合自己的版本。比如这里下载的是docker-19.03.9.tgz

2、复制docker-19.03.9.tgz到服务器上,解压:tar xzvf docker-19.03.9.tgz

3、进入docker目录复制所有文件到/usr/bin目录下,目的/user/bin是环境变量目录,在路径下都可以运行docker命令

ls -l docker cp docker/* /usr/bin/ 
[root@localhost local]# tar xvf docker-19.03.9.tgz docker/ docker/docker-init docker/runc docker/docker docker/docker-proxy docker/containerd docker/ctr docker/dockerd docker/containerd-shim [root@localhost local]# ls -l docker total 195504 -rwxr-xr-x. 1 lr lr 32751272 May 14 17:29 containerd -rwxr-xr-x. 1 lr lr 6012928 May 14 17:29 containerd-shim -rwxr-xr-x. 1 lr lr 18194536 May 14 17:29 ctr -rwxr-xr-x. 1 lr lr 61113382 May 14 17:29 docker -rwxr-xr-x. 1 lr lr 68874208 May 14 17:29 dockerd -rwxr-xr-x. 1 lr lr 708616 May 14 17:29 docker-init -rwxr-xr-x. 1 lr lr 2928514 May 14 17:29 docker-proxy -rwxr-xr-x. 1 lr lr 9600696 May 14 17:29 runc [root@localhost local]# mv docker/* /usr/bin/ [root@localhost local]# 
vim /etc/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 

赋执行权限

chmod +x /etc/systemd/system/docker.service systemctl daemon-reload 

#开机启动

systemctl enable docker.service 

启动docker

systemctl start docker 

配置 docker 加速

vim /etc/docker/daemon.json 

添加如下内容

{ "registry-mirrors": [ "https://hub-mirror.c.163.com/", "https://registry.docker-cn.com" ] } 

重启配置生效

systemctl daemon-reload systemctl restart docker 

原文链接:https://blog.csdn.net/qq_23501739/article/details/130650988?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171836840916800226555627%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=171836840916800226555627&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-4-130650988-null-null.nonecase&utm_term=docker%E3%80%81%E5%A5%BD%E7%94%A8

© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享