{"id":79096,"date":"2026-11-17T02:03:34","date_gmt":"2026-11-17T02:03:34","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79096"},"modified":"2026-11-17T02:03:34","modified_gmt":"2026-11-17T02:03:34","slug":"linux-advanced-2-02-containers","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79096","title":{"rendered":"Linux Advanced 2 02 \u2014 Rootless Containers with Podman"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1993\">Linux Advanced 2 category<\/a> \u00b7 Lesson 2 of 7<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AI disclosure<\/strong> \u2014 AI-generated content, posted as is. AI can make mistakes. This extension adds new material and links related posts from this site. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learning goal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Serve a fixture with rootless Podman and verify that its port is published only on loopback.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concepts and setup<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The site discusses Docker, Vagrant, MicroK8s, and isolated lab networks. Here, an image provides the container\u2019s starting filesystem, a bind mount exposes one chosen host path, and port publishing maps a host listener to a container port. Rootless mode avoids using host root to run the engine. It does not give the same isolation model as a VM. Use Podman as a regular user in a disposable VM. Use approved registry sources, and record a digest to identify the exact image used.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Run a loopback-only test site<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>lab=$(mktemp -d)\nmkdir -m 755 &quot;$lab\/site&quot;\nprintf 'rootless lab page\\n' &gt; &quot;$lab\/site\/index.html&quot;\nchmod 644 &quot;$lab\/site\/index.html&quot;\npodman info --format '{{.Host.Security.Rootless}}'\npodman run -d --name oe-linux-web \\\n  -p 127.0.0.1:8088:80 \\\n  -v &quot;$lab\/site:\/usr\/share\/nginx\/html:ro,Z&quot; \\\n  docker.io\/library\/nginx:1.28-alpine\npodman port oe-linux-web\ncurl -fsS http:\/\/127.0.0.1:8088\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>true\n...\n80\/tcp -&gt; 127.0.0.1:8088\nrootless lab page<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use an unused name and free port. Allow the service a moment to start. :ro applies inside the container. :Z is for private SELinux labeling of this disposable fixture, not your whole home or system data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Inspect and remove the container<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>podman inspect --format '{{.State.Status}} {{.Image}}' oe-linux-web\npodman logs --tail 4 oe-linux-web\npodman stop oe-linux-web\npodman rm oe-linux-web<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>running sha256:...\n... &quot;GET \/ HTTP\/1.1&quot; 200 ...\noe-linux-web\noe-linux-web<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Removing this container leaves the bind-mounted host folder. Remove that test folder only when done.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Questions only<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Why are direct remote connections not accepted here?<\/li>\n\n\n<li>Does :ro make the host directory read-only to the owner?<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>If curl refuses the connection, what are your first checks?<\/li>\n\n\n<li>Why record a digest instead of only a tag?<\/li>\n\n\n<li>How could you prove the file comes from the bind mount?<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Questions and answers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check answers<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Why are direct remote connections not accepted here?<\/strong><br><strong>Answer<\/strong> \u2014 The listener is bound to loopback.<\/li>\n\n\n<li><strong>Does :ro make the host directory read-only to the owner?<\/strong><br><strong>Answer<\/strong> \u2014 No. The option applies to the container\u2019s mount.<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment answer key<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>If curl refuses the connection, what are your first checks?<\/strong><br><strong>Answer<\/strong> \u2014 Check podman state, logs and port mapping, then ss -ltn. Confirm no other program uses the port.<\/li>\n\n\n<li><strong>Why record a digest instead of only a tag?<\/strong><br><strong>Answer<\/strong> \u2014 The tag can point to a different build later, while the digest identifies exact image content.<\/li>\n\n\n<li><strong>How could you prove the file comes from the bind mount?<\/strong><br><strong>Answer<\/strong> \u2014 Change the host fixture to contain one unique marker, fetch it again, and compare.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Related source articles on this site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=75995\">Docker File<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=74445\">Docker and Vagrant  Optional Java and\/or PHP Platform<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=76008\">MicroK8s Commands in Ubuntu<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78732\">Understanding Host-Only Networking in Oracle VirtualBox: Concepts, Tools, IP Addressing, DHCP, and Practical Options<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Technical references<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/docs.podman.io\/en\/stable\/markdown\/podman-create.1.html\">Podman port and volume options<\/a><\/li>\n\n\n<li><a href=\"https:\/\/hub.docker.com\/_\/nginx\">Official nginx image<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Continue the course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Previous lesson 01 \u2014 Hardening a systemd Service. Next lesson 03 \u2014 Repeatable Configuration with Ansible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1993\">Linux Advanced 2 category<\/a> \u00b7 Lesson 2 of 7<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Serve a fixture with rootless Podman and verify that its port is published only on loopback.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1993],"tags":[],"class_list":["post-79096","post","type-post","status-publish","format-standard","hentry","category-linux-advanced-2","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79102,"url":"http:\/\/bangla.sitestree.com\/?p=79102","url_meta":{"origin":79096,"position":0},"title":"Linux Administration Course \u2014 Start Here and Lesson Index","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"A 33-lesson Linux course from shell fundamentals to server administration, performance, and a recovery capstone.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79095,"url":"http:\/\/bangla.sitestree.com\/?p=79095","url_meta":{"origin":79096,"position":1},"title":"Linux Advanced 2 01 \u2014 Hardening a systemd Service","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Run a small systemd service with a dedicated dynamic identity and a narrow writable directory.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79097,"url":"http:\/\/bangla.sitestree.com\/?p=79097","url_meta":{"origin":79096,"position":2},"title":"Linux Advanced 2 03 \u2014 Repeatable Configuration with Ansible","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Convert a small configuration task into an Ansible playbook and demonstrate idempotence.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79101,"url":"http:\/\/bangla.sitestree.com\/?p=79101","url_meta":{"origin":79096,"position":3},"title":"Linux Advanced 2 07 \u2014 Capstone: Build, Diagnose, and Recover a Linux Service","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Demonstrate Linux service deployment, evidence-led incident diagnosis, and recovery in one lab.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79093,"url":"http:\/\/bangla.sitestree.com\/?p=79093","url_meta":{"origin":79096,"position":4},"title":"Linux Advanced 08 \u2014 Apache Virtual Hosts and HTTPS","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Test Apache name-based routing locally and verify HTTPS with certificate and renewal checks.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79100,"url":"http:\/\/bangla.sitestree.com\/?p=79100","url_meta":{"origin":79096,"position":5},"title":"Linux Advanced 2 06 \u2014 Encrypted Backups and Restore Drills","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Create an encrypted Restic snapshot and verify a real restore into a separate directory.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79096"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79096\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79096"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}