Home  >  Article  >  Computer Tutorials  >  Install Docker offline on Linux system

Install Docker offline on Linux system

PHPz
PHPzforward
2024-02-27 15:30:031117browse

Linux 系统离线安装Docker

In Linux systems, offline installation of Docker usually occurs in the following situations:

In some deployment environments, network restrictions or firewall settings may affect the ability to install Docker online directly through Docker's official warehouse.

For security reasons, some environments do not allow direct connection to external networks, so offline methods are required to install and update software.

Stability requirements: For systems with higher stability requirements, offline installation can ensure that Docker is compatible with other system components and avoid potential risks that may be caused by online updates.

Let’s take a look at the specific operation methods.

1. Download the installation package

Docker all offline package paths

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

linux stable version:

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

2. Unzip

Take tar -zxvf docker-20.10.20.tgz as an example

Copy docker-20.10.20.tgz to the server and decompress:

tar -zxvf docker-20.10.20.tgz

3. Copy to the specified directory

Copy all the files in the unzipped docker directory to the /usr/bin directory. The destination /user/bin is the environment variable directory

mv docker/* /usr/bin/

4. Edit configuration file

vim /etc/systemd/system/docker.service

Add file content:

[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

5. Modify execution permissions

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

6. Set startup

systemctl enable docker.service

7.Start docker

systemctl start docker

8.Verification

docker -v
Docker version 20.10.20, build 370c289

In addition, the specific installation steps may vary depending on the Linux distribution and version. Therefore, before proceeding with offline installation, it is recommended to consult the documentation or community support of the target Linux system for more detailed installation guides and system-specific guidance.

Online installation: Automatically install using the official installation script

The installation command is as follows:

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

You can also use the domestic daocloud one-click installation command:

curl -sSL https://get.daocloud.io/docker | sh

The above is the detailed content of Install Docker offline on Linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete