TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Perl as PID 1 under Docker

71 pointsby dioclesover 7 years ago

6 comments

tomjakubowskiover 7 years ago
I was relieved to see the article mention dumb-init in its conclusion. It&#x27;s very likely what you want if you&#x27;re not booting your containers with a full init system, and the README has a thorough explanation of why and how dumb-init works.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Yelp&#x2F;dumb-init" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Yelp&#x2F;dumb-init</a>
评论 #15160365 未加载
评论 #15161092 未加载
kjetijorover 7 years ago
No mention of linux&#x27; pid_namespaces documentation ?<p>&gt; Only signals for which the &quot;init&quot; process has established a signal handler can be sent to the &quot;init&quot; process by other members of the PID namespace. This restriction applies even to privileged processes, and prevents other members of the PID namespace from accidentally killing the &quot;init&quot; process.<p>&gt; Likewise, a process in an ancestor namespace can—subject to the usual permission checks described in kill(2)—send signals to the &quot;init&quot; process of a child PID namespace only if the &quot;init&quot; process has established a handler for that signal.
评论 #15160242 未加载
评论 #15160330 未加载
jbergstroemover 7 years ago
Ran into the same issue with the mysql docker container which ultimately bothered me into making my own. Started off experimenting with trapping signals (trap foo INT,..) similar to the article but found this nifty `--gdb` (nowadays `--debug-gdb`) flag to mysqld that enables more signal handling.<p>Source: `docker pull jbergstroem&#x2F;mariadb-alpine`<p>edit: docker should really open the doors for a cleanup&#x2F;shutdown phase. There&#x27;s both entrypoint and cmd but not a &quot;exit&quot; command.
andrestcover 7 years ago
Nice writeup. Interesting enough, SIGKILL does not work from inside the container: <a href="https:&#x2F;&#x2F;andrestc.com&#x2F;post&#x2F;killing-container-inside&#x2F;" rel="nofollow">https:&#x2F;&#x2F;andrestc.com&#x2F;post&#x2F;killing-container-inside&#x2F;</a>.
alacombeover 7 years ago
I wonder if using the --init flag would also fix the docker issue with bash scripts getting in an infinite loop when the script catch signals:<p># Run with care...<p>$ sudo docker run -it docker.io&#x2F;ubuntu:14.04 &#x2F;bin&#x2F;bash -c &#x27;trap x EXIT; x() { echo exit; }; while sleep 1; do echo sleep; done&#x27;<p>^C<p>[bash enter in infinite loop]<p>I&#x27;m asking because my Fedora 25 install does not include docker 1.13 yet.
评论 #15162829 未加载
Matthias247over 7 years ago
Noticed the same thing when running a node.js application in docker a while ago. Adding a signal handler manually fixed it easily. It was just not expected to be necessary.
评论 #15162838 未加载