当前位置:首页>Linux>Docker本地化安装Linux

Docker本地化安装Linux

  • 2026-09-05 01:38:42
Docker本地化安装Linux

下载Docker安装包

https://download.docker.com/linux/static/stable/x86_64/

二、上传解压

tar -xvf docker-29.1.2.tgz

三、将解压出来的docker文件内容移动到 /usr/bin/ 目录下

cp docker/* /usr/bin/

四、将docker注册为service

vim /etc/systemd/system/docker.service
[Unit]Description=Docker Application Container EngineDocumentation=https://docs.docker.comAfter=network-online.target firewalld.serviceWants=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 dockerExecStart=/usr/bin/dockerdExecReload=/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=infinityLimitNPROC=infinityLimitCORE=infinity# Uncomment TasksMax if your systemd version supports it.# Only systemd 226 and above support this version.#TasksMax=infinityTimeoutStartSec=0# set delegate yes so that systemd does not reset the cgroups of docker containersDelegate=yes# kill only the docker process, not all processes in the cgroupKillMode=process# restart the docker process if it exits prematurelyRestart=on-failureStartLimitBurst=3StartLimitInterval=60s[Install]WantedBy=multi-user.target

五、添加文件权限并启动docker

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

六、重载unit配置文件

systemctl daemon-reload

七、启动Docker

systemctl start docker 

八、设置开机自启

systemctl enable docker.service  

九、验证

systemctl status docker    #查看Docker状态
docker version             #查看Docker版本

最新文章

随机文章