Docker离线安装

  1. 安装目录

    复制代码
    mkdir /opt/docker && cd /opt/docker
  2. 安装包下载

    复制代码
    yum -y install wget && wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz
    注意:https://download.docker.com/linux/static/stable/x86_64 获取最新版本下载链接并替换(docker-xxx.tgz)
  3. 安装包解压

    复制代码
    tar -xvf docker-24.0.7.tgz && cp docker/* /usr/bin/
  4. 注册服务

    复制代码
    sudo tee /usr/lib/systemd/system/docker.service <<-'EOF'
    [Unit]
    Description=Docker Application Container Engine
    Documentation=http://docs.docker.com
    After=network.target docker.socket
    [Service]
    Type=notify
    EnvironmentFile=-/run/flannel/docker
    WorkingDirectory=/usr/local/bin
    ExecStart=/usr/bin/dockerd \
                    -H tcp://0.0.0.0:4243 \
                    -H unix:///var/run/docker.sock \
                    --selinux-enabled=false \
                    --log-opt max-size=1g
    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=on-failure
    [Install]
    WantedBy=multi-user.target
    EOF
  5. 镜像源配置

    复制代码
    sudo mkdir -p /etc/docker/
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
      "registry-mirrors": ["https://8q5nyauc.mirror.aliyuncs.com"]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker
  6. 启动服务

    复制代码
    启动:systemctl start docker
    停止:systemctl stop docker
    重启:systemctl restart docker
    开机启动:systemctl enable docker
相关推荐
眠りたいです1 分钟前
Mysql常用内置函数,复合查询及内外连接
linux·数据库·c++·mysql
我的泪换不回玫瑰3 分钟前
Linux系统管理命令
linux
i小溪40 分钟前
在使用 Docker 时,如果容器挂载的数据目录(如 `/var/moments`)位于数据盘,只要服务没有读写,数据盘是否就不会被唤醒?
人工智能·docker
jjkkzzzz1 小时前
Linux下的C/C++开发之操作Zookeeper
linux·zookeeper·c/c++
二当家的素材网1 小时前
Centos和麒麟系统如何每天晚上2点10分定时备份达梦数据库
linux·数据库·centos
挑战者6668881 小时前
CentOS 系统高效部署 Dify 全攻略
linux·运维·centos
DD_陈东东1 小时前
gdbus 常用数据结构与库函数
linux
DIY机器人工房2 小时前
代码详细注释:ARM-Linux字符设备驱动开发案例:LCD汉字输出改进建议开发板断电重启还能显示汉字,显示汉字位置自定义
linux·嵌入式·文件io·diy机器人工房
得物技术3 小时前
eBPF 助力 NAS 分钟级别 Pod 实例溯源|得物技术
linux
Rudon滨海渔村3 小时前
解决阿里云ubuntu内存溢出导致vps死机无法访问 - 永久性增加ubuntu的swap空间 - 阿里云Linux实例内存溢出(OOM)问题修复方案
linux·运维·ubuntu