• linux系统离线安装docker服务教程


    1、下载、上传docker-20.10.0.tgz压缩包至服务器,其中,docker下载地址https://download.docker.com/linux/static/stable/x86_64/

    2、新建安装docker脚本docker-install.sh

    1. #!/usr/bin/env bash
    2. tar -xvf docker-20.10.0.tgz
    3. cp docker/* /usr/bin/
    4. cat <<-EOF >/etc/systemd/system/docker.service
    5. [Unit]
    6. Description=Docker Application Container Engine
    7. Documentation=https://docs.docker.com
    8. After=network-online.target firewalld.service
    9. Wants=network-online.target
    10. [Service]
    11. Type=notify
    12. # the default is not to use systemd for cgroups because the delegate issues still
    13. # exists and systemd currently does not support the cgroup feature set required
    14. # for containers run by docker
    15. ExecStart=/usr/bin/dockerd
    16. ExecReload=/bin/kill -s HUP $MAINPID
    17. # Having non-zero Limit*s causes performance problems due to accounting overhead
    18. # in the kernel. We recommend using cgroups to do container-local accounting.
    19. LimitNOFILE=infinity
    20. LimitNPROC=infinity
    21. LimitCORE=infinity
    22. # Uncomment TasksMax if your systemd version supports it.
    23. # Only systemd 226 and above support this version.
    24. #TasksMax=infinity
    25. TimeoutStartSec=0
    26. # set delegate yes so that systemd does not reset the cgroups of docker containers
    27. Delegate=yes
    28. # kill only the docker process, not all processes in the cgroup
    29. KillMode=process
    30. # restart the docker process if it exits prematurely
    31. Restart=on-failure
    32. StartLimitBurst=3
    33. StartLimitInterval=60s
    34. [Install]
    35. WantedBy=multi-user.target
    36. EOF
    37. chmod +x /etc/systemd/system/docker.service
    38. systemctl daemon-reload
    39. systemctl start docker
    40. systemctl enable docker.service
    41. docker -v

    3、运行脚本

    1. root@ubuntu:/# ./docker-install.sh
    2. docker/
    3. docker/containerd
    4. docker/docker-init
    5. docker/ctr
    6. docker/containerd-shim
    7. docker/containerd-shim-runc-v2
    8. docker/runc
    9. docker/docker-proxy
    10. docker/dockerd
    11. docker/docker
    12. Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /etc/systemd/system/docker.service.
    13. Docker version 20.10.0, build 7287ab3

    4、运行结果

    1. root@ubuntu:/# systemctl status docker
    2. ● docker.service - Docker Application Container Engine
    3. Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: enabled)
    4. Active: active (running) since Tue 2024-02-20 22:53:18 PST; 10s ago
    5. Docs: https://docs.docker.com
    6. Main PID: 7145 (dockerd)
    7. Tasks: 21 (limit: 4646)
    8. CGroup: /system.slice/docker.service
    9. ├─7145 /usr/bin/dockerd
    10. └─7168 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
    11. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.149432511-08:00" level=warning msg="Your kernel does not support CPU realtime scheduler"
    12. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.149442663-08:00" level=warning msg="Your kernel does not support cgroup blkio weight"
    13. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.149448355-08:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
    14. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.149727745-08:00" level=info msg="Loading containers: start."
    15. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.402469679-08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.18.0.0/16. Daemon option --bip can be used to s
    16. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.565861504-08:00" level=info msg="Loading containers: done."
    17. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.704370268-08:00" level=info msg="Docker daemon" commit=eeddea2 graphdriver(s)=overlay2 version=20.10.0
    18. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.704532504-08:00" level=info msg="Daemon has completed initialization"
    19. Feb 20 22:53:18 ubuntu systemd[1]: Started Docker Application Container Engine.
    20. Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.793607753-08:00" level=info msg="API listen on /var/run/docker.sock"
  • 相关阅读:
    BurpSuite靶场系列之OS命令注入
    【Java项目】讲讲我用Java爬虫获取LOL英雄数据与图片(附源码)
    Linux安装node
    国产MCU芯片(2):东软MCU概览
    NLP大模型微调答疑
    实现切换图片透明度轮播效果
    jail内部ubuntu apt升级失败问题解决-Dynamic MMap ran out of room
    JDBC入门、数据库连接方式
    leetcode 1002. 查找共用字符
    MySQL数据库——第一节 — MySQL数据库基础
  • 原文地址:https://blog.csdn.net/vinegar93/article/details/136213304