{"id":4147,"date":"2025-03-27T22:07:58","date_gmt":"2025-03-27T19:07:58","guid":{"rendered":"https:\/\/demensdeum.com\/blog\/2025\/03\/27\/docker-rootless\/"},"modified":"2025-03-27T22:34:42","modified_gmt":"2025-03-27T19:34:42","slug":"docker-rootless","status":"publish","type":"post","link":"https:\/\/demensdeum.com\/blog\/2025\/03\/27\/docker-rootless\/","title":{"rendered":"Docker safety: Why is the launch of Root is a bad idea"},"content":{"rendered":"<p>Docker has become an indispensable tool in modern Devops and development. It allows you to isolate the encirclement, simplify the outfit and quickly scale applications. However, by default, Docker requires a ROOT, and this creates a potentially dangerous zone, which is often ignored in the early stages.<\/p>\n<h2> Why does Docker work from Root? <\/ h2><\/h2>\n<p>Docker uses the capabilities of the Linux: Cgroups, Namespaces, Iptables, Mount, Networking and other system functions. These operations are available only to the super -user.<\/p>\n<p>That&#8217;s why:<br \/>\n* Dockerd demon starts from Root,<br \/>\n* Docker commands are transmitted to this demon.<\/p>\n<p>This simplifies the work and gives full control over the system, but at the same time it opens up potential vulnerabilities.<\/p>\n<h2> Why is it dangerous: Container Breakout, CVE, RCE <\/ H2><\/h2>\n<h3> Container Breakout <\/ h3><\/h3>\n<p>With weak insulation, an attacker can use Chroot or Pivot_root to enter the host.<\/p>\n<p>Examples of real attacks:<\/p>\n<p>* CVE-2019-5736-vulnerability to RUNC, allowed to rewrite the application and execute the code on the host.<br \/>\n* CVE-2021-3156-vulnerability to SUDO, allowed to get a ROOT inside the container and get out.<\/p>\n<h3> RCE (Remote Code Execution) <\/ H3><\/h3>\n<p>If the application in the container is vulnerable and starts from Root, RCE = full control over the host.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/demensdeum.com\/blog\/wp-content\/uploads\/2025\/03\/mediadocker-rootless.png\"><\/p>\n<h2> Rootless Docker: Solution of the problem <\/ h2><\/h2>\n<p>To minimize these risks, Rootless mode appeared in Docker. In this mode, both the demon and the containers are launched on behalf of the usual user, without any Root-privilegies. This means that even if an attacker receives control over the container, he will not be able to harm the host system.<br \/>\nThere are restrictions: you can not use ports below 1024 (for example, 80 and 443), the &#8211;privileged mode, as well as some network modes, is not available. However, in most development scenarios and CI\/CD Rootless Docker, it copes with its task and significantly increases the level of security.<\/p>\n<h2> Historically, launch from Root &#8211; Antipattern <\/ h2><\/h2>\n<p>From the very beginning, the principle of the smallest privileges has been applied in the Unix\/Linux world. The fewer rights the process, the less harm it can do. Docker initially demanded a Root access, but today it is considered a potential threat.<\/p>\n<h2> Sources <\/ h2><\/h2>\n<p><a href=\"https:\/\/docs.docker.com\/engine\/security\/rootless\/\" rel=\"noopener\" target=\"_blank\">https:\/\/docs.docker.com\/engine\/security\/rootless\/<\/a><br \/>\n<a href=\"https:\/\/rootlesscontaine.rs\/\" rel=\"noopener\" target=\"_blank\">https:\/\/rootlesscontaine.rs\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker has become an indispensable tool in modern Devops and development. It allows you to isolate the encirclement, simplify the outfit and quickly scale applications. However, by default, Docker requires a ROOT, and this creates a potentially dangerous zone, which is often ignored in the early stages. Why does Docker work from Root? Docker uses<a class=\"more-link\" href=\"https:\/\/demensdeum.com\/blog\/2025\/03\/27\/docker-rootless\/\">Continue reading <span class=\"screen-reader-text\">&#8220;Docker safety: Why is the launch of Root is a bad idea&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-4147","post","type-post","status-publish","format-standard","hentry","category-blog","entry"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"en","enabled_languages":["en","ru","zh","de","fr","ja","pt","hi"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"ru":{"title":true,"content":true,"excerpt":false},"zh":{"title":true,"content":true,"excerpt":false},"de":{"title":true,"content":true,"excerpt":false},"fr":{"title":true,"content":true,"excerpt":false},"ja":{"title":true,"content":true,"excerpt":false},"pt":{"title":true,"content":true,"excerpt":false},"hi":{"title":false,"content":false,"excerpt":false}}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/4147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/comments?post=4147"}],"version-history":[{"count":6,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/4147\/revisions"}],"predecessor-version":[{"id":4153,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/4147\/revisions\/4153"}],"wp:attachment":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/media?parent=4147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/categories?post=4147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/tags?post=4147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}