在码头集装箱中嵌入代码或将其作为卷安装? [英] Embed code in docker container or mount it as a volume?

查看:150
本文介绍了在码头集装箱中嵌入代码或将其作为卷安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个最近的docker用户,我即将从我的生产环境中的VM迁移到容器。
但是,我突然意识到,对于我的开发环境和qa环境来说,这是非常理想的。

I'm a recent user of docker and I am about to migrate from VM to containers in my production environment. But then, I suddenly realize that what works perfectly for my dev and qa environments is not ideal for production.

在我的开发人员和qa上,我挂载了版本化的项目文件夹成为一个python / php(名称它)容器,我认为这个容器为我的代码的运行服务。当我更改代码(git commit or else)时,这样可以避免容器历史没有变化。

On my dev and qa, I mount my versioned project folder into a python/php (name it) container and I consider this container as a "running service" for my code. This saves me from having huge containers as the container history doesnt change when I change my code (git commit or else).

在生产中,理想的情况是,我将有干净的自包含容器,我的代码在里面,不像我在开发中那样安装。

In production, the ideal case is that I will have clean self contained containers with my code inside, not mounted like I do in dev.

那么,我错了吗?你怎么做呢?
您是否使用与dev相同的容器来生成?

So, did I get it wrong? How do you do it? Do you use the same containers from dev to prod?

推荐答案

我在开发环境中也是一样的。我有一个生产Docker文件,ADD项目文件夹,然后我运行所有的测试。由于开发容器和生产容器之间的区别是将代码添加到容器中,而不是代码或设置,它们具有相同的行为。

I do the same for in my development environment. I have a a production Dockerfile that ADDs the project folder and then I run all the tests against it. Since the difference between the development container and the production container is when the code is added to the container, not the code or settings, they have the same behavior.

这篇关于在码头集装箱中嵌入代码或将其作为卷安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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