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

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

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

#!/usr/bin/env bash
tar -xvf docker-20.10.0.tgz

cp docker/* /usr/bin/

cat <<-EOF >/etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=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 docker
ExecStart=/usr/bin/dockerd
ExecReload=/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=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# 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
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target
EOF

chmod +x /etc/systemd/system/docker.service

systemctl daemon-reload

systemctl start docker

systemctl enable docker.service

docker -v

3、运行脚本

root@ubuntu:/# ./docker-install.sh 
docker/
docker/containerd
docker/docker-init
docker/ctr
docker/containerd-shim
docker/containerd-shim-runc-v2
docker/runc
docker/docker-proxy
docker/dockerd
docker/docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /etc/systemd/system/docker.service.
Docker version 20.10.0, build 7287ab3

4、运行结果

root@ubuntu:/# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2024-02-20 22:53:18 PST; 10s ago
     Docs: https://docs.docker.com
 Main PID: 7145 (dockerd)
    Tasks: 21 (limit: 4646)
   CGroup: /system.slice/docker.service
           ├─7145 /usr/bin/dockerd
           └─7168 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

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"
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"
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"
Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.149727745-08:00" level=info msg="Loading containers: start."
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
Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.565861504-08:00" level=info msg="Loading containers: done."
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
Feb 20 22:53:18 ubuntu dockerd[7145]: time="2024-02-20T22:53:18.704532504-08:00" level=info msg="Daemon has completed initialization"
Feb 20 22:53:18 ubuntu systemd[1]: Started Docker Application Container Engine.
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"

相关推荐

  1. linux系统线安装docker服务教程

    2024-02-22 07:42:01       57 阅读
  2. docker线安装教程

    2024-02-22 07:42:01       61 阅读
  3. linux线和在线安装docker

    2024-02-22 07:42:01       68 阅读
  4. Docker线安装

    2024-02-22 07:42:01       46 阅读
  5. 线安装docker

    2024-02-22 07:42:01       53 阅读
  6. docker线安装

    2024-02-22 07:42:01       41 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-22 07:42:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-22 07:42:01       100 阅读
  3. 在Django里面运行非项目文件

    2024-02-22 07:42:01       82 阅读
  4. Python语言-面向对象

    2024-02-22 07:42:01       91 阅读

热门阅读

  1. 深度学习基础之《TensorFlow框架(5)—会话》

    2024-02-22 07:42:01       56 阅读
  2. select滑动分页请求数据

    2024-02-22 07:42:01       51 阅读
  3. springboot 控制层 aop 日志

    2024-02-22 07:42:01       50 阅读
  4. 深度学习????????

    2024-02-22 07:42:01       53 阅读
  5. BeautifulSoup的使用与入门

    2024-02-22 07:42:01       50 阅读
  6. 计算机科学背后的故事和挑战

    2024-02-22 07:42:01       57 阅读
  7. 设计模式-策略模式

    2024-02-22 07:42:01       50 阅读
  8. 高级统计方法 第1次作业

    2024-02-22 07:42:01       52 阅读
  9. nginx的配置文件详解

    2024-02-22 07:42:01       43 阅读
  10. day38打卡

    2024-02-22 07:42:01       53 阅读