当前位置: 首页 > news >正文

ubuntu离线安装docker导入镜像

docker安装包

准备工作

1.准备一个docker.service文件

内容如下:

[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 -H unix:///var/run/docker.sock --selinux-enabled=false --default-ulimit nofile=65536:65536
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

假定安装包和docker.service文件以及各种镜像包都在/home/carrot/docker中

正片开始

进入位置

cd /home/carrot/docker

解压

tar -zxvf docker-24.0.7.tgz

复制

sudo cp docker/* /usr/bin
sudo cp docker.service /etc/systemd/system/

赋予权限

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

开启docker并并设置开机自启动

sudo systemctl daemon-reload
sudo systemctl start docker
sudo systemctl enable docker.service

收尾

将准备好的镜像包导入(以ubuntu镜像包为例)注意xxx.tar 是通过其他服务器执行docker save获取的

sudo  docker load -i xxx.tar

使用docker权限不足时

# 添加docker用户组,一般已存在,不需要执行sudo groupadd docker# 将登陆用户加入到docker用户组中sudo gpasswd -a $USER docker# 更新用户组newgrp docker# 以上操作不行就重启 (慎用)sudo reboot

镜像导入完成后删除多余文件

cd ..
rm -r docker

http://www.lryc.cn/news/382922.html

相关文章:

  • 鸿蒙原生应用元服务开发-位置服务申请权限
  • 基于SpringBoot的“智慧食堂”管理系统设计与实现
  • 高效记录收支明细:揭秘如何通过曲线图精准分析每月开销
  • 开发注意事项
  • Vue79-路由组件独有的2个新的生命周期钩子
  • Lua博客网站支持搜索、评论、登录注册
  • BGP高级特性
  • 鸿蒙开发:1.环境搭建和入门
  • python学习 - 设计模式 - 组合模式
  • JavaScript倒序遍历数组:计算年度累积值
  • 华为仓颉编程语言观感
  • Elasticsearch:倒数排序融合 - Reciprocal rank fusion - 8.14
  • Day13—大语言模型
  • php基础语法_面向对象
  • 开源模型应用落地-LangChain高阶-LCEL-表达式语言(八)
  • c# 协议数据计算陀螺仪的角度,带符号
  • ArcGIS arcpy代码工具——批量要素裁剪栅格影像
  • discuz插件之优雅草超级列表互动增强v1.2版本更新
  • 三、用户中心项目笔记----后端多环境实战+原始部署
  • SpringMVC的使用
  • Vue73-命名路由
  • TrustOne发布一周年成绩单,15000家数智化转型客户的选择!
  • Nginx实战:故障处理_后端服务正常,nginx偶发502(Bad Gateway)
  • mac系统清理软件哪个好用?CleanMyMac X清理工具轻松拿捏mac
  • 拔掉独显提升性能,AMD新一代核显可以通杀主流游戏了
  • 关于单片机那些事?
  • 第5章 传输层
  • 典型传感器简介及驱动安装
  • linux和Win——显卡驱动、Anaconda及pytorch安装(无需单独安装cuda、cudnn)
  • 机器学习之多模态学习FLAVA(Foundational Language and Vision Alignment)