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

docker离线和在线安装

一.docker环境

1.在线安装

###########centos在线安装############# #1.更新yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum clean all yum makecache #2.添加docker国内镜像源 yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo #3.安装docker yum -y install docker-ce docker-ce-cli containerd.io ##########ubuntu在线安装######### apt install -y docker.io

2.离线安装

#1.自己准备docker离线包,本文自带 dockerBin.zip #2.解压移动文件 unzip dockerBin.zip cp ./docker/* /usr/bin/ #启动程序 cp ./docker/docker.service /etc/systemd/system #开机自启文件,末尾有,第4小节 #3.启动docker、开机自启、查看docker启动状态 systemctl daemon-reload #重新加载systemctl文件 systemctl start docker && systemctl enable docker && systemctl status docker #4.docker.service文件如下 cat docker.service [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com # BindsTo=containerd.service After=network-online.target firewalld.service # containerd.service Wants=network-online.target # Requires=docker.socket [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 EnvironmentFile=-/etc/sysconfig/docker EnvironmentFile=-/etc/sysconfig/docker-storage EnvironmentFile=-/etc/sysconfig/docker-network Environment=GOTRACEBACK=crash ExecStart=/usr/bin/dockerd $OPTIONS \ $DOCKER_STORAGE_OPTIONS \ $DOCKER_NETWORK_OPTIONS \ $INSECURE_REGISTRY # -H fd:// --containerd=/run/containerd/containerd.sock ExecReload=/bin/kill -s HUP $MAINPID TimeoutSec=0 RestartSec=2 Restart=always # Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229. # Both the old, and new location are accepted by systemd 229 and up, so using the old location # to make them work for either version of systemd. StartLimitBurst=3 # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230. # Both the old, and new name are accepted by systemd 230 and up, so using the old name to make # this option work for either version of systemd. StartLimitInterval=60s # 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 # Comment TasksMax if your systemd version does not support it. # Only systemd 226 and above support this option. TasksMax=infinity # 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 [Install] WantedBy=multi-user.target

3.docker镜像加速配置

#编写/etc/docker/daemon.json配置文件 #1.基础版本,完全够用 tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://ej3odski.mirror.aliyuncs.com"] } EOF #2.不理解不要配 tee /etc/docker/daemon.json <<-'EOF' { "log-driver": "json-file", "log-opts": { "max-size": "100m", "max-file": "3" }, "exec-opts": ["native.cgroupdriver=systemd"], "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ], "registry-mirrors": [ "https://docker.mirrors.ustc.edu.cn", "https://hub-mirror.c.163.com" ] } EOF #注意配置文件更新后需要重启docker systemctl restart docker
http://www.jsqmd.com/news/1354560/

相关文章:

  • VERT文件转换器架构解析:WebAssembly如何重塑250+格式的本地化处理方案
  • 2026 榆林新房全案装修 免费量房VR设计优选推荐 - 资讯123
  • 实用指南:快速掌握League Spartan开源字体的完整使用方法
  • 2026 鄂尔多斯家装水电防水施工 长效质保安心优选推荐 - 资讯123
  • YamlDotNet 终极指南:五分钟掌握 .NET 平台最强 YAML 库
  • 如何高效使用Open 3D Model Viewer:专业用户的完整实战指南
  • 青岛靠谱二手奢侈品实体店推荐 连锁还是本地老店?我选有奢有得 - 品牌品鉴馆
  • 揭秘Grayskull的高效算法:嵌入式设备上的ORB特征提取与匹配
  • tonutils-go完全指南:用纯Golang构建TON区块链应用的终极工具
  • Thalo完全指南:WebAssembly驱动的事件溯源运行时核心概念与实战入门
  • Animiru完全指南:如何打造你的一站式视频播放与媒体库管理中心
  • 5分钟极速打包:PakePlus让网页变身专业桌面应用
  • TencentDB Agent Memory Docker部署指南:快速搭建隔离式记忆服务环境
  • 2026 鄂尔多斯家装避坑攻略 分项验收付款更靠谱推荐 - 资讯123
  • Basset模型完全解析:如何用深度学习预测164种细胞类型的染色质可及性
  • 从零到精通:KoboldAI本地化部署7天实战完全手册
  • DeepCpG-DNA模型实战指南:从安装到预测的完整流程(附代码示例)
  • 2026 榆林环保家装优选 全系高端辅材保真推荐 - 资讯123
  • CloudWalker Platform高级技巧:自定义规则与批量检测API应用
  • 编辑距离内存暴涨复盘:二维表如何滚成两行h
  • OK3588-C开发板源代码编译以及烧写image
  • 2026青岛二手奢侈品实体店 回收寄卖 正规店铺 - 品牌品鉴馆
  • Legacy iOS Kit:终极iOS设备降级恢复工具完整指南
  • 公司网站集群系统架构及建设思路:从底层逻辑到落地执行的实战指南
  • 2026 鄂尔多斯新房装修设计 实景落地还原度高优选 - 资讯123
  • 2026 榆林装修杜绝乱加价 预算决算一致优选推荐 - 资讯123
  • 告别复制粘贴:Umi-OCR离线文字识别工具全面指南
  • 揭秘js-stellar-sdk内部机制:核心组件与代码实现原理
  • ky-universal快速上手指南:5分钟实现跨环境HTTP请求
  • 3分钟快速上手:在Windows电脑上运行Android应用的终极解决方案