Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can dumb-init not run in daemon mod? #179

Open
fanux opened this issue Nov 20, 2018 · 8 comments
Open

Can dumb-init not run in daemon mod? #179

fanux opened this issue Nov 20, 2018 · 8 comments

Comments

@fanux
Copy link

fanux commented Nov 20, 2018

We want to use dumb-init to start keepalived in the container, but it runs as daemon mod, so container exists immediately. Can dumb-init run on the front?

@asottile
Copy link
Contributor

The answer to the question is no, by design. I believe you want keepalived -n to run keepalived in the foreground

@chriskuehl
Copy link
Contributor

Just to clarify, I think the issue is that keepalived is daemonizing, rather than dumb-init?

@fanux
Copy link
Author

fanux commented Nov 21, 2018

Yes, @asottile if use -n flag keepalived will not fork a child process, script check will not work.
@chriskuehl supervisor has this config:

[supervisord]
nodaemon = true

It useful for many daemons run in the container, I think dumb-init support this will be great!

@asottile
Copy link
Contributor

hmmm I suspect you're missing the point of dumb-init (and to some extent, docker containers in general)

docker is not intended to be a virtual machine manager. An ideal container runs a single process (-tree) which does one thing. dumb-init assists in this manner as being the init system for that single process (and forwards signals to it). dumb-init is not a supervisor -- it will not restart your process if it dies and will not health check your process. dumb-init is also not a daemon manager -- you shouldn't daemonize your application in docker, you should run it in the foreground.

That said, if you want to bend the rules, you can run a supervisor or a daemon manager. For example it isn't all that uncommon to have a process tree that looks like dumb-init -> (runit / supervisor) -> (child)+

Usually you'll want to use docker containers in conjunction with some sort of framework such as kubernetes / mesos which will provide the health checking / container management -- trying to have a container healthcheck itself doesn't really make all that much sense in that context.

@fanux
Copy link
Author

fanux commented Nov 21, 2018

I strongly follow the one container single process principle, but if I want to run some process like keepalived in a container will cause some problems. I don't need a supervisor, don't need daemon manager or health check, just need dumb-init support run in the foreground...

By the way, this issue is clearly not caused by dumb-init

@asottile
Copy link
Contributor

dumb-init only supports running in the foreground -- and with keepalived the way to do that is by using -n -- are you seeing otherwise?

@fanux
Copy link
Author

fanux commented Nov 21, 2018

Yes keepalived -n flag will cause keepalived don't fork a child process, and check script will not work.

 -n, --dont-fork              Don't fork the daemon process

@asottile
Copy link
Contributor

what do you mean "check script"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants