首页 > 其他分享 >离线安装docker

离线安装docker

时间:2022-12-05 22:45:44浏览次数:36  
标签:opt bin 离线 version usr docker 安装 20.10

#!/bin/bash
#
url=https://download.docker.com/linux/static/stable/x86_64
docker_version=$1
get_docker(){
    [ -d "/opt/docker-${docker_version:-20.10.9}" ] || mkdir /opt/docker-${docker_version:-20.10.9}
    
    cd /opt/docker-${docker_version:-20.10.9} &&\

    wget ${url}/docker-${docker_version:-20.10.9}.tgz 
    #
    tar xf docker-${docker_version:-20.10.9}.tgz && \
    ln -sf /opt/docker-${docker_version:-20.10.9}/docker/dockerd /usr/bin/dockerd
    ln -sf /opt/docker-${docker_version:-20.10.9}/docker/docker /usr/bin/docker
}

systemctlfile_docker(){
cat >/usr/lib/systemd/system/docker.service<<EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service

[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 docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP \$MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3

# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s

# 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=infinity
LimitNPROC=infinity
LimitCORE=infinity

# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity

# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes

# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500

[Install]
WantedBy=multi-user.target
EOF

cat >/usr/lib/systemd/system/docker.socket <<EOF
[Unit]
Description=Docker Socket for the API

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target
EOF
}

start_docker(){
    systemctl daemon-reload
    systemctl enable docker --now
}
main(){
    get_docker
    systemctlfile_docker
    start_docker
}

main

标签:opt,bin,离线,version,usr,docker,安装,20.10
From: https://www.cnblogs.com/wangend/p/16953773.html

相关文章

  • 【原创】mitmdump 安装证书至手机系统证书
    <table><tr><tdbgcolor=orange>本文所有教程及源码、软件仅为技术研究。不涉及计算机信息系统功能的删除、修改、增加、干扰,更不会影响计算机信息系统的正常运行。不得将代......
  • Oracle19c安装及Excel连接
    一、软件安装1.下载压缩包,解压,双击该文件夹下的setup.exe 2.会弹出这样一个控制台窗口,稍等片刻即可 3.第一个窗口,选中【创建并配置单实例数据库】,点击下一步4.选中......
  • Pr2023(Premiere Pro)中文版软件下载「附带安装教程」
    PremierePro23.0版专为帮助编辑人员制作创意内容而设计,提供了出色的字幕工具组合。借助改进功能(如批量编辑时间轴中的标题剪辑、灵活的对齐控件等)简化您的标题和图形工......
  • 源代码配置安装Apache
    源代码配置安装Apache......
  • 20221205 常用Docker部署
    MySQLMySQL-DockerHub准备my.cnf配置文件[mysqld]character_set_server=utf8[client]default-character-set=utf8上传my.cnf到宿主机/data/docker/my......
  • NVIDIA Jetson TX2安装opencv4.1
    mkdirbuildvimcv_cmake.sh#!/bin/bashcmake\-DCMAKE_BUILD_TYPE=Release\-DCMAKE_INSTALL_PREFIX=/usr\-DBUILD_PNG=OFF\......
  • Docker远程挂载volumn插件vieux/sshfs
    通常,用在本地容器需要挂载一个远程目录的时候来使用安装vieux/sshfs插件dockerplugininstall--grant-all-permissionsvieux/sshfs使用镜像加速,我是没有下载成功......
  • VMware Fusion 13虚拟机如何安装win 11教程
    VM虚拟机如何安装win11?还不知道如何在VMwareFusion13虚拟机中安装win11的朋友,下面就和小编一起来了解一下!1、运行VMwareFusion13虚拟机,在「新建虚拟机」界面上,拖拽......
  • maya-usd编译、安装指南
     1、克隆maya-usd的代码https://github.com/Autodesk/maya-usd2、使用python3.7编译安装usd(参考https://www.cnblogs.com/BstuderBlog/p/15840609.html)3、下载mayasdk......
  • AVS最新安装教程。。。
    1,安装环境包yuminstallscreen -ytar -cvf /www/web/lnmp/public_html/lnmp1.2-full.tar /www/web/lnmp/public_html/lnmp1.2-fulltarcvf /www/web/lnmp/public_......