如何在 docker 容器中为 ubuntu 创建本地镜像?

How to create local mirror for ubuntu inside docker container?

我想在 docker 容器内为 Ubuntu 创建本地镜像。这是我从 git 中心关注的 link。 https://github.com/ekino/docker-images

现在的问题是下载整个包花费了太多时间,尽管我把它分成了 main、restricted 和 universe 部分,但它正在下载 22 GB 的包。我的系统自上次 48 小时以来一直处于开机状态,但仍未完成。是的,我有足够的互联网速度。但我认为它进入无限循环并卡在某个地方。

有没有其他方法可以做到这一点?有什么建议吗?

非常感谢您!

docker 容器 copy-on-write file system is slow, you want to make sure the data you download gets written to a fast file system. That's what the VOLUME 指令用于 Docker 文件。

然后要保留该数据,您必须在主机文件系统上安装该卷或使用 Docker 数据容器。有关卷的更多信息,请参阅 this article