赞
踩
本实践将在 Ubuntu 22.04.3LTS 系统上进行测试
docker 版本Docker Engine - Community 24.0.6
,原则上docker版本无影响
本实践进仅学习研究使用,无作他用途。
曾几何时,docker镜像的拉去会失败,网速会慢,那会我们的通常处理方案是镜像加速。如今,镜像加速已经失效,我们如何解决?
本文将介绍一种解决方案的详细步骤,同时给出其他方案。
此方案需要你有一台可以正常访问官方镜像的服务器。
# 服务器上备份 , 服务器通过为特殊的私有网络
docker save -o ubuntu.tar ubuntu:latest
# 恢复到目标服务器 , 目标服务器通常为研发环境正常网络
docker load -i ubuntu.tar
32G
我用第一种方法竟然不能保存
pytorch/pytorch:1.9.0-cuda11.1-cudnn8-devel
Compressed Size7.54 GB
Skopeo
各平台安装方法参考
https://github.com/containers/skopeo/blob/main/install.md
# Ubuntu 20.10 and newer
sudo apt-get -y update
sudo apt-get -y install skopeo
# 目前最新版本 1.15.1
skopeo -v
# skopeo version 1.4.1
测试了下目前版本够用,就没折腾安装最新版本了。
# 保存镜像
skopeo copy --retry-times=16 docker://pytorch/pytorch:1.9.0-cuda11.1-cudnn8-devel docker-archive:pytorch-1.9.0-cuda11.1-cudnn8-devel.tar:pytorch/pytorch:1.9.0-cuda11.1-cudnn8-devel
# 看了下大小,比官网压缩的大了好多好多,怪不得 16*2 = 32G 不够
du -sh pytorch-1.9.0-cuda11.1-cudnn8-devel.tar
16G pytorch-1.9.0-cuda11.1-cudnn8-devel.tar
# 恢复镜像
docker load -i pytorch-1.9.0-cuda11.1-cudnn8-devel.tar
# 或
skopeo copy docker-archive:pytorch-1.9.0-cuda11.1-cudnn8-devel.tar docker-daemon:pytorch/pytorch:1.9.0-cuda11.1-cudnn8-devel
阿里出品
image-syncer
镜像同步工具 , 参考网站https://github.com/AliyunContainerService/image-syncer
image-syncer 是一个容器镜像同步工具,可用来进行多对多的镜像仓库同步,支持目前绝大多数主流的 docker 镜像仓库服务
image-syncer
是一个容器镜像同步工具,可用来进行多对多的镜像仓库同步,支持目前绝大多数主流的 docker 镜像仓库服务
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。