创建docker映像“离线安装程序”的最佳方法是 [英] The best way to create docker image "offline installer"

查看:101
本文介绍了创建docker映像“离线安装程序”的最佳方法是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用docker-compose文件获取Elasticsearch Logstash Kibana堆栈。一切正常,

I use docker-compose file to get Elasticsearch Logstash Kibana stack. Everything works fine,


docker-compose build

docker-compose build

命令创建三个映像,每个映像约600 MB,从docker存储库所需的层下载。

command creates three images, about 600 MB each, downloads from docker repository needed layers.

现在,我需要执行相同操作,但是在没有互联网。从存储库下载是不可能的。我需要创建离线安装程序。我发现的最好方法是

Now, I need to do the same, but at the machine with no Internet access. Downloading from respositories there is impossible. I need to create "offline installer". The best way I found is


docker save image1 image2 image3 -o archivebackup.tar

docker save image1 image2 image3 -o archivebackup.tar

,但创建的文件将近2GB。

but created file is almost 2GB. During


docker-compose build

docker-compose build

命令某些数据是从Internet下载的,但肯定少于2GB。

command some data are downloaded from the Internet but it is definitely less than 2GB.

什么是创建我的离线安装程序的更好方法,以避免使其过大?

What is a better way to create my "offline installer", to avoid making it so big?

推荐答案

创建Docker脱机安装程序的最佳方法是

The best way to create the Docker offline Installer is to


  • 列表项

  • 获取CI / CD管道以生成TAR文件作为构建过程。

  • 稍后使用所需的TAR文件创建本地文件夹

  • 编写脚本以将这些TAR文件加载到计算机上

  • 同一脚本可以触发 docker-compose up -d 命令以启动整个服务生态系统

  • List item
  • Get the CI/CD pipeline to generate the TAR file as build process.
  • Later create a local folder with the required TAR files
  • Write a script to load these TAR files on the machine
  • The same script can fire the docker-compose up -d command to bring up the whole service ecosystem

注意:在启动服务之前加载图像很重要

Note : It is important to load the images before bringing up the services

关于尺寸问题,Yamenk的答案特别指出了尺寸增大的原因。原因是码头工人不拉共享层。

Regarding the size issue the answer by Yamenk specifically points to the reason why the size increases. The reason is docker does not pull the shared layers.

这篇关于创建docker映像“离线安装程序”的最佳方法是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆