3

如何快速进行离线安装Docker

 5 months ago
source link: https://www.51cto.com/article/784877.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

如何快速进行离线安装Docker

作者:微技术 2024-03-28 14:40:55

Docker是一个开源的应用容器引擎,它让开发者能够将应用打包在一个可移植的容器中,然后发布到任何流行的Linux机器或Windows机器上。通过使用Docker,开发者可以创建、部署和运行应用程序,而无需担心基础设施的问题。

Docker是一个开源的应用容器引擎,它让开发者能够将应用打包在一个可移植的容器中,然后发布到任何流行的Linux机器或Windows机器上。通过使用Docker,开发者可以创建、部署和运行应用程序,而无需担心基础设施的问题。

e2866b495d766dda56f38849e807187cf77841.jpg

然而,在一些特定的环境下,如限制访问互联网的内部网络或外出旅行时,离线安装和使用Docker变得非常必要。在这篇文章中,我们将详细介绍如何下载并安装Docker,然后将其复制到另一台无网络的机器上,以实现在无网络环境下的正常运行。

1.下载安装包

docker所有离线包路径

http://get.daocloud.io/docker/builds/

linux稳定版:

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

以tar -zxvf docker-20.10.6.tgz为例

复制docker-20.10.6.tgz到服务器上,解压:

tar -zxvf docker-20.10.6.tgz

3.复制到指定目录

将解压docker目录下所有文件复制到/usr/bin目录下,目的/user/bin是环境变量目录

mv docker/* /usr/bin/

4.编辑配置文件

vim /etc/systemd/system/docker.service

添加文件内容:

[Unit]
Descriptinotallow=Docker Application Container Engine
Documentatinotallow=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

5.修改执行权限

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

6.设置开机启动

systemctl enable docker.service

7.启动docker

systemctl start docker
docker -v
Docker version 20.10.6, build 370c289

在线安装:使用官方安装脚本自动安装

安装命令如下:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

也可以使用国内 daocloud 一键安装命令:

curl -sSL https://get.daocloud.io/docker | sh
责任编辑:华轩 来源: 微技术之家

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK