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
相关推荐
牛奔3 小时前
Docker配置远程连接
运维·docker·云原生·容器·eureka
my_styles4 小时前
docker-compose部署项目(springboot服务)以及基础环境(mysql、redis等)ruoyi-ry
spring boot·redis·后端·mysql·spring cloud·docker·容器
Liudef067 小时前
使用Docker部署MongoDB
mongodb·docker·容器
ZHOU_WUYI9 小时前
React与Docker中的MySQL进行交互
mysql·react.js·docker
Will_11309 小时前
如何实现k8s高可用
运维·docker·容器
编程、小哥哥9 小时前
互联网大厂Java面试场景:从缓存到容器化的技术问答
redis·docker·微服务·kubernetes·spring security·java面试·gitlab ci
luck_me511 小时前
基于 Kubernetes 部署容器平台kubesphere
云原生·容器·kubernetes
小白要努力sgy11 小时前
深入理解Docker和K8S
docker·kubernetes
青春不流名11 小时前
ctr查看镜像
docker
意倾城11 小时前
Docker 网络
docker·容器