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
相关推荐
M4K03 小时前
Linux百度网盘优化三板斧
linux
好奇的菜鸟3 小时前
如何在 Ubuntu 24.04 (Noble) 上使用阿里源
linux·运维·ubuntu
bcbobo21cn4 小时前
初步了解Linux etc/profile文件
linux·运维·服务器·shell·profile
望获linux4 小时前
【实时Linux实战系列】CPU 隔离与屏蔽技术
java·linux·运维·服务器·操作系统·开源软件·嵌入式软件
0wioiw04 小时前
C#基础(项目结构和编译运行)
linux·运维·服务器
2401_873587825 小时前
Linux常见指令以及权限理解
linux·运维·服务器
Arthurmoo5 小时前
Linux系统之MySQL数据库基础
linux·数据库·mysql
李洋-蛟龙腾飞公司6 小时前
HarmonyOS NEXT应用元服务常见列表操作分组吸顶场景
linux·运维·windows
链上Sniper6 小时前
智能合约状态快照技术:实现 EVM 状态的快速同步与回滚
java·大数据·linux·运维·web3·区块链·智能合约
晨曦丿7 小时前
双11服务器
linux·服务器·网络