Docker-每个容器一个进程? [英] Docker - one process per container?

查看:206
本文介绍了Docker-每个容器一个进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我会使用Docker进行开发工作。当我这样做时,通常会使用 tutum 。



我的问题是:如果Docker在一个容器中运行多个进程,这是否违反了使用Docker的目的? (就像容器是从Tutum的LAMP映像开始的)那样,不是整个Docker的想法就是将每个进程都分离到一个单独的容器中吗? p>通常,在这种情况下,有时需要将一个容器用于一个以上的过程。



当将多个过程一起使用以实现其目的时,会发生这种情况任务。我可以想象例如有人想要通过使用ELK(Elasticsearch,Logstash,Kibana)向Web应用程序添加日志记录的情况。这些东西可以一起运行,并且可以有主管来监视一个容器内的过程。



但是在大​​多数情况下,每个容器最好使用一个过程 。还有什么docker命令应该自己启动进程,例如运行Java复制程序

  / usr / bin / java -jar application.jar 

除了运行外部脚本:

  ./ launchApplication.sh 

请参阅 http://www.reddit上的讨论.com / r / docker / comments / 2t1lzp / docker_and_the_pid_1_zombie_reaping_problem / 在出现问题的地方。


I sometimes use Docker for my development work. When I do, I usually work on an out-of-the-box LAMP image from tutum.

My question is: Doesn't it defeat the purpose to work with Docker if it runs multiple processes in one container? (like the container started off Tutum's LAMP image) Isn't the whole idea of Docker to separate each process into a separate container?

解决方案

Generally sometimes it is neccessary or more useful to use one container for more than one process like in this situation.

Such situation happens when processes are used together to fulfill its task. I can imagine for example situation when somebody want to add logging to the web application by using ELK (Elasticsearch, Logstash, Kibana). Those things run together and can have supervisor for monitoring processes inside one container.

But for most cases it is better to use one process per container. What is more docker command should start process itself, for example running java aplication by

/usr/bin/java -jar application.jar

apart from running external script:

./launchApplication.sh

See discussion on http://www.reddit.com/r/docker/comments/2t1lzp/docker_and_the_pid_1_zombie_reaping_problem/ where the problem is concerned.

这篇关于Docker-每个容器一个进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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