Is docker suitable to be used for long running containers?

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

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.