Open vikstrous opened 7 years ago
provided you don't need multiple supervised processes per containers you should checkout dum-init, otherwise use overlay-s6. But since you said init i'm assuming you need init more than process supervision https://github.com/Yelp/dumb-init
relevant lines per dockerfile: ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /dumb-init RUN chmod +x /dumb-init ENTRYPOINT ["/dumb-init", "--"] CMD ["array", "style", "cmd"]
Lessons learned the hard way:
When done properly you can verify via ps auxf and docker stop will nearly immediately kill the container instead of timing out.
Docker has a new built in init feature. You can docker run --init
now. I'm hoping that will be enough. I can get rid of the shell wrapper by replacing the last command in each CMD script with an exec. Hopefully that's enough to make signal handling work... I'll have to try it.
Here's a good example of how to do it properly: https://github.com/gryphius/syslog-stdout