Install Docker offline on Linux system

PHPz
Release: 2024-02-27 15:30:03
forward
1134 people have browsed it

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
Copy after login

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/
Copy after login

4. Edit configuration file

vim /etc/systemd/system/docker.service
Copy after login

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
Copy after login

5. Modify execution permissions

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

6. Set startup

systemctl enable docker.service
Copy after login

7.Start docker

systemctl start docker
Copy after login

8.Verification

docker -v
Docker version 20.10.20, build 370c289
Copy after login

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
Copy after login

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

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

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!

Related labels:
source:mryunwei.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template