docker(6) : 离线安装docker

本文介绍了如何在Linux系统中离线安装Docker 19.03.9,包括解压安装包、复制文件到指定路径、创建并配置docker.service文件,以及启动和设置Docker开机自启的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考 : 

         Linux离线安装Docker - lujuhao - 博客园

        linux配置docker源,国内加速镜像(注册阿里云镜像)_docker加速 清华源-优快云博客 

        Docker:Linux离线安装docker-17.03.2-ce,配置开机自启 - 怒吼的萝卜 - 博客园

说明 : 本次安装包为 docker-19.03.9.tgz

1.下载安装包

docker离线安装包下载地址: https://download.docker.com/linux/static/stable/x86_64/

2.解压

tar zxvf docker-19.03.9.tgz -C ./

3.复制文件

cp docker/* /usr/bin/

4.在/etc/systemd/system目录下创建docker.service文件,并配置如下内容保存

cat > /etc/systemd/system/docker.service << 'EOF'
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=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 docker
ExecStart=/usr/bin/dockerd
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 the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

EOF

5.启动docker

# 添加可执行权限
chmod +x /etc/systemd/system/docker.service
# 重载unit配置文件
systemctl daemon-reload
# 启动Docker
systemctl start docker
# 设置开机自启
systemctl enable docker.service
# 查看Docker状态
systemctl status docker

6.配置国内镜像加速 

cat > /etc/docker/daemon.json <<'EOF'
{
  "registry-mirrors":[
    "https://registry.docker-cn.com",				
	"https://mirrors.tuna.tsinghua.edu.cn",			
	"https://aeckruos.mirror.aliyuncs.com",			
	"http://hub-mirror.c.163.com",					
	"https://docker.mirrors.ustc.edu.cn",			
  ]
}
EOF


systemctl restart docker

 

docker(15) : 卸载docker_Lxinccode的博客-优快云博客

END。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值