8

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?

Dodge
  • 218
  • 3
  • 7
  • did you end up running Docker containers in a long-term, "replace kvm VMs" fashion, and how did it go for you? – Johnny Utahh Mar 17 '20 at 22:53
  • @JohnnyUtahh back then no. until now i never actually touched docker again. but at work I'm once again working on docker and we are close to migrate our first production applications to docker. :) – Dodge Mar 18 '20 at 07:25
  • Thanks @Dodge. If you're able, pls let us know how it goes. – Johnny Utahh Mar 18 '20 at 16:55

2 Answers2

7

Docker is used all over the place for web apps which are long running apps. Currently in production I have the following running in docker

  • php-fpm apps
  • celery queue workers (python)
  • nodejs apps
  • java tomcat7
  • Go
Mike
  • 22,310
  • 7
  • 56
  • 79
  • 3
    I think i can interpret your answer as "yes you can use Docker for long running apps/services". Thank you! :) – Dodge Jan 15 '16 at 14:09
7

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.

MadHatter
  • 79,770
  • 20
  • 184
  • 232
  • +1 for clarification about countainer vs virtualisation. while this is not really an answer to my question this is still something everyone with a similar question should be aware of. I'm aware of that. i required the dedicated server as i had more advanced requirements eg a windows installation so i required KVM (or a similar *virtualization*). those requirements are gone and all i want (not even need) is to keep some services isolated and thats where a container should be enough in my case. – Dodge Jan 16 '16 at 09:47
  • @Dodge thank you, seriously, for those words (and the upvote). My answer is me bending over backwards *not* to say "*for the love of God, don't use containerisation in production*". That's what I really want to say, but I know that many do it - and many of those get away with it. – MadHatter Jan 16 '16 at 10:06
  • so if i understand you correctly you say one should not use a container in production? may i ask why? – Dodge Jan 16 '16 at 10:24
  • @Dodge. No. That is what I *want* to say, because I've never known the practice work out well, but my experience doesn't justify that answer because I know there are people who do it, and don't have disasters. What I *actually* say is in my answer, and hopefully represents how to avoid all the traps I've seen people fall into. – MadHatter Jan 16 '16 at 11:13
  • Okay, i think i got it. Thank you very much for your time and feedback. :) I'll give it a try and if it does not work out well I'll try something else. Luckily this is not for some kind of commercial purpose but only private stuff. no one (but me) will care if something is down for a day or two. :D (thats also the reason why i decided to reduce the costs after no longer needing the full power of the old machine) – Dodge Jan 16 '16 at 11:30