Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install docker offline under Linux

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to install docker offline under Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Sometimes the server cannot be connected to the Internet, so it is impossible to install docker with yum. In this case, offline installation can be used.

1. Prepare docker offline package

Download the version of docker that needs to be installed. What I download this time is

Docker-17.03.2-ce.tgz version 2. Prepare the docker.service system profile

Docker.service [Unit] Description=Docker Application Container EngineDocumentation= https://docs.docker.comAfter=network-online.target firewalld.serviceWants=network-online.target [Service] Type=notify# the default is not to use systemd for cgroups because the delegate issues still# exists and systemd currently does not support the cgroup feature set required# for containers run by dockerExecStart=/usr/bin/dockerdExecReload=/bin/kill-s HUP $MAINPID# Having non-zero Limit*s causes performance problems due to accounting overhead# in the kernel. We recommend using cgroups to do container-local accounting.LimitNOFILE=infinityLimitNPROC=infinityLimitCORE=infinity# Uncomment TasksMax if your systemd version supports it.# Only systemd 226and above support this version.#TasksMax=infinityTimeoutStartSec=0# set delegate yes so that systemd does not reset the cgroups of docker containersDelegate=yes# kill only the docker process, not all processes in the cgroupKillMode=process# restart the docker process if it exits prematurelyRestart=on-failureStartLimitBurst=3StartLimitInterval=60s [Install] WantedBy=multi-user.target displays details

3. Prepare the installation script and uninstall script

Installation script install.sh

#! / bin/shecho 'unpack tar package...' tar-xvf $1echo 'move docker directory to / usr/bin directory...' cp docker/* / usr/bin/echo 'move docker.service to / etc/systemd/system/ directory...' cp docker.service / etc/systemd/system/echo 'add file permissions...' chmod + x / etc/systemd/system/docker.serviceecho 'reload configuration file.' systemctl daemon- Reloadecho 'Boot docker...'systemctl start dockerecho' setting Boot self... 'systemctl enable docker.serviceecho' docker installed successfully... 'docker-v displays details

Uninstall script uninstall.sh

#! / bin/shecho 'Delete docker.service...'rm-f / etc/systemd/system/docker.serviceecho' Delete docker file...'rm-rf / usr/bin/docker*echo 'Reload configuration file' systemctl daemon-reloadecho 'unloaded successfully. 4. Install

4.1 the directory is as follows: (you only need to follow docker-17.03.2-ce.tgz, docker.service, install.sh and uninstall.sh)

4.2 execute script sh install.sh docker-17.03.2-ce.tgz

The execution process is as follows:

After the script is executed, execute docker-v

It is found that docker has been successfully installed at this time. You can use docker-- help to check the docker command. From now on, you can install image and container yourself.

Sh uninstall.sh4.3 if you want to uninstall docker, execute the script sh uninstall.sh at this time, as follows:

At this point, type docker-v and find that docker has been uninstalled

The above is all the contents of the article "how to install docker offline under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report