docker离线安装并修改存储目录

docker下载

根据cpu选择不同版本,正常x86就选x86_64

下载地址:https://download.docker.com/linux/static/stable/

docker安装

bash 复制代码
tar -zxvf arm-docker-25.0.4.tgz
sudo cp docker/* /usr/bin/
rm -rf docker/*
mkdir /etc/docker
vi /etc/docker/daemon.json

填入内容

bash 复制代码
{
  "data-root": "/data/docker"
}

设置启动项

bash 复制代码
vi /usr/lib/systemd/system/docker.service

填入内容

bash 复制代码
[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

docker启动

bash 复制代码
systemctl daemon-reload
systemctl start docker
相关推荐
loong_XL1 小时前
docker gpu容器镜像环境构建
运维·docker·容器
胡斌附体8 小时前
linux(ubuntu)拉取源码进行docker容器部署
linux·git·ubuntu·docker·node·nvm
开发者联盟league9 小时前
k8s 创建token
云原生·容器·kubernetes
扑火的小飞蛾10 小时前
RHEL 7 安装 Docker 过程总结
运维·docker·容器
web小白成长日记11 小时前
Node.js 编程实战:部署 Node.js 应用 —— Docker 容器化部署
docker·容器·node.js
柠檬汁Dev11 小时前
已有 K8s 集群如何加装 Sealos 桌面
云原生·容器·kubernetes
飞翔沫沫情13 小时前
kubeadm部署 Kubernetes(k8s) 高可用集群 V1.32
云原生·容器·kubernetes
木卫二号Coding13 小时前
Docker-构建自己的Web-Linux系统-镜像colinchang/ubuntu-desktop:22.04
linux·ubuntu·docker
春日见15 小时前
Docker中如何删除镜像
运维·前端·人工智能·驱动开发·算法·docker·容器
Anastasiozzzz16 小时前
Docker介绍与常见指令
运维·docker·容器