简体   繁体   English

如何加载和离线运行使用 docker-compose 构建构建的 docker 映像?

[英]How to load and run offline docker image built using docker-compose build?

I'm new to docker and have been dabbling with it for the past few days.我是 docker 的新手,过去几天一直在涉足它。 I've managed to successfully use docker-compose for a multi-container deployment involving an app server (flask + gunicorn) and web server (nginx).我已经成功地将 docker-compose 用于涉及应用服务器(flask + gunicorn)和 web 服务器(nginx)的多容器部署。

Now, I'd like to recreate the deployment on an offline machine.现在,我想在离线机器上重新创建部署。 After doing research, it seems that most have mentioned use docker save and docker load to transfer over the base images.经过研究,似乎大多数人都提到使用 docker 保存和 docker 加载来传输基础图像。 However, I'm wondering whether its possible to recreate the deployment from the image created by docker-compose build?但是,我想知道是否可以从 docker-compose 构建创建的映像重新创建部署? Reason being I would like to skip the entire process of wheeling my python package dependencies for offline use, which I would have to do for the method starting from the base images.原因是我想跳过将我的 python package 依赖项转为离线使用的整个过程,对于从基础图像开始的方法,我必须这样做。

I've tried to save that particular image (output of docker-compose build) and load it on the offline machine, and then tried docker run and docker-compose up but both don't seem to work.我尝试保存该特定图像(docker-compose 构建的输出)并将其加载到离线机器上,然后尝试运行 docker 和 docker-compose,但两者似乎都不起作用。 Would like to check with the community whether this method is even possible, and if so what's the right way to go about it?想与社区一起检查这种方法是否可行,如果可以,go 的正确方法是什么?

Thanks!谢谢!

To solve my issue, I ended up making an image of each individual container post pip install, then using docker-compose.yml simply to spin them up.为了解决我的问题,我最终在 pip 安装后制作了每个容器的图像,然后使用 docker-compose.yml 简单地启动它们。 As David mentioned, it doesn't seem possible to spin up the container from the single image output by docker-compose build.正如大卫所提到的,似乎不可能从 docker-compose 构建的单个图像 output 启动容器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM