大网数据广告活动
服务器运维问答

Is docker suitable to be used for long running containers?

· 52CE 我爱测

I'm currently migrating from a powerfull root server to a less powerfull and most notably cheaper server. On the root server i had some services isolated into separate VMs. On the new server this is not possible. But I'd like to …

问题原文

原帖链接 · Dodge · CC BY-SA 3.0

I'm currently migrating from a powerfull root server to a less powerfull and most notably cheaper server. On the root server i had some services isolated into separate VMs. On the new server this is not possible. But I'd like to still have some isolation for some services... If possible.

Currently I'm thinking of using docker for this isolation. But I'm not sure if docker is the right tool here. I tried to google for an answer but most posts i found about docker are only related to short term containers for development, ci or testing purposes. In my case it would be more like having a long term container that runs eg a web service stack with nginx, php and mysql/mariadb (while the db might even get its own container) and other container that run other services.

so my question is: Is Docker suitable for a task of running a container for a longer time. or in other words... is docker usable as a "replacement" for kvm based VMs?

社区高分解答

原帖链接 · MadHatter · CC BY-SA 3.0

As with all judgement calls, there will be some opinion in any answer. Nevertheless, it is definitely true to say that containerisation is not virtualisation. They are different technologies, working in different ways, with different pros and cons. To regard containerisation as virtualisation lite is to make a fundamental mistake, just as regarding a virtualised guest as a cheap dedicated server is a mistake. We see a lot of questions on SF from people that have been sold a container as a "cheap VPS"; misunderstanding what they have, they try to treat it as a virtualised guest, and cause themselves trouble.

Containerisation is undoubtedly excellent for development work: it enables a very large number of environments to be spun up very quickly, and thus makes development on multiple fast-changing copies of a slowly-changing reference back end very easy. Note that in this scenario the containers are all very similar in infrastructure and function; they're all essentially subtly-different copies of a single back-end.

Trouble may arise when people try to containerise multiple distros on a single host, or guests have different needs in terms of kernel modules, or external hardware connectivity arises as an issue - and in many other comparable departures from the scenarios where containerisation really does work well.

If you decide to deploy into production on containers, keep your mind on what you've done, and don't fall into the mindset of thinking of your deployment as virtualised; be aware that saving money has opportunity costs associated with it. Cut your coat according to your cloth, and you may very well have a good experience. But allow yourself (or, more commonly, management) to misunderstand what you've done, and trouble may ensue.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。