{"id":1911,"date":"2024-08-13T04:32:15","date_gmt":"2024-08-13T04:32:15","guid":{"rendered":"https:\/\/www.nicktailor.com\/?p=1911"},"modified":"2024-12-06T08:22:11","modified_gmt":"2024-12-06T08:22:11","slug":"mastering-podman-a-comprehensive-guide-with-detailed-command-examples","status":"publish","type":"post","link":"https:\/\/nicktailor.com\/tech-blog\/mastering-podman-a-comprehensive-guide-with-detailed-command-examples\/","title":{"rendered":"Mastering Podman: A Comprehensive Guide with Detailed Command Examples"},"content":{"rendered":"<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong>Mastering Podman on Ubuntu: A Comprehensive Guide with Detailed Command Examples<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Podman has become a popular alternative to Docker due to its flexibility, security, and rootless operation capabilities. This guide will walk you through the installation process and various advanced usage scenarios of Podman on Ubuntu, providing detailed examples for each command.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Table of Contents<\/strong><\/p>\n<div class=\"ol\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">1.<\/span><a href=\"#how-to-install-podman\">How to Install Podman<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">2.<\/span><a href=\"#how-to-search-for-images\">How to Search for Images<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">3.<\/span><a href=\"#how-to-run-rootless-containers\">How to Run Rootless Containers<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">4.<\/span><a href=\"#how-to-search-for-containers\">How to Search for Containers<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">5.<\/span><a href=\"#how-to-add-ping-to-containers\">How to Add Ping to Containers<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">6.<\/span><a href=\"#how-to-expose-ports\">How to Expose Ports<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">7.<\/span><a href=\"#how-to-create-a-network\">How to Create a Network<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">8.<\/span><a href=\"#how-to-connect-a-network-between-pods\">How to Connect a Network Between Pods<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">9.<\/span><a href=\"#how-to-inspect-a-network\">How to Inspect a Network<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">10.<\/span><a href=\"#how-to-add-a-static-address\">How to Add a Static Address<\/a><\/div>\n<\/div>\n<div class=\"li\" style=\"margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;\">\n<div style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;margin-left:36pt;\"><span style=\"display:inline-block;position:relative;text-indent:-18pt;\">11.<\/span><a href=\"#how-to-log-on-to-a-container-with-bash\">How to Log On to a Container with <\/a><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"background:#a0a0a0;width:0;height:1.5pt;display:inline-block;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>1. How to Install Podman<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">To get started with Podman on Ubuntu, follow these steps:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Update Package Index<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Before installing any new software, it&#8217;s a good idea to update your package index to ensure you&#8217;re getting the latest version of Podman:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">sudo apt update<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Install Podman<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">With your package index updated, you can now install Podman. This command will download and install Podman and any necessary dependencies:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">sudo apt install podman -y<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">kotlin<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Reading package lists&#8230; Done<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Building dependency tree       <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Reading state information&#8230; Done<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">The following additional packages will be installed:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">  &#8230;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">After this operation, X MB of additional disk space will be used.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Do you want to continue? [Y\/n] y<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">&#8230;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Setting up podman (4.0.2) &#8230;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Verifying Installation<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">After installation, verify that Podman is installed correctly:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman &#8211;version<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman version 4.0.2<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>2. How to Search for Images<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Before running a container, you may need to find an appropriate image. Podman allows you to search for images in various registries.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Search Docker Hub<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">To search for images on Docker Hub:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman search ubuntu<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">lua<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">INDEX       NAME                                     DESCRIPTION                                       STARS     OFFICIAL   AUTOMATED<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">docker.io   docker.io\/library\/ubuntu                 Ubuntu is a Debian-based Linux operating sys&#8230;   12329     [OK]       <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">docker.io   docker.io\/ubuntu-upstart                 Upstart is an event-based replacement for the &#8230;   108       [OK]       <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">docker.io   docker.io\/tutum\/ubuntu                   Ubuntu image with SSH access. For the root p&#8230;   39                   <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">docker.io   docker.io\/ansible\/ubuntu14.04-ansible    Ubuntu 14.04 LTS with ansible                     9                    [OK]<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">This command will return a list of Ubuntu images available in Docker Hub.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>3. How to Run Rootless Containers<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">One of the key features of Podman is the ability to run containers without needing root privileges, enhancing security.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Running a Rootless Container<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">As a non-root user, you can run a container like this:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run &#8211;rm -it ubuntu <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">ruby<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">root@d2f56a8d1234:\/# <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">This command runs an Ubuntu container in an interactive  shell, without requiring root access on the host system.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Configuring Rootless Environment<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Ensure your user is added to the subuid and subgid files for proper UID\/GID mapping:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">echo &#8220;$USER:100000:65536&#8221; | sudo tee -a \/etc\/subuid \/etc\/subgid<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">makefile<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">user:100000:65536<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">user:100000:65536<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>4. How to Search for Containers<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Once you start using containers, you may need to find specific ones.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Listing All Containers<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">To list all containers (both running and stopped):<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman ps -a<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">CONTAINER ID  IMAGE                             COMMAND    CREATED         STATUS                     PORTS  NAMES<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">d13c5bcf30fd  docker.io\/library\/ubuntu:latest          3 minutes ago   Exited (0) 2 minutes ago          confident_mayer<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Filtering Containers<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">You can filter containers by their status, names, or other attributes. For instance, to find running containers:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman ps &#8211;filter status=running<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">CONTAINER ID  IMAGE                            COMMAND  CREATED       STATUS            PORTS  NAMES<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">No output indicates there are no running containers at the moment.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>5. How to Add Ping to Containers<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Some minimal Ubuntu images don\u2019t come with ping installed. Here\u2019s how to add it.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Installing Ping in an Ubuntu Container<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">First, start an Ubuntu container:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -it &#8211;cap-add=CAP_NET_RAW ubuntu <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Inside the container, install ping (part of the iputils-ping package):<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">apt update<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">apt install iputils-ping<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">mathematica<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Get:1 http:\/\/archive.ubuntu.com\/ubuntu focal InRelease [265 kB]<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">&#8230;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Setting up iputils-ping (3:20190709-3) &#8230;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Now you can use ping within the container.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>6. How to Expose Ports<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Exposing ports is crucial for running services that need to be accessible from outside the container.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Exposing a Port<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">To expose a port, use the -p flag with the podman run command:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -d -p 8080:80 ubuntu  -c &#8220;apt update &amp;&amp; apt install -y nginx &amp;&amp; nginx -g &#8216;daemon off;'&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">54c11dff6a8d9b6f896028f2857c6d74bda60f61ff178165e041e5e2cb0c51c8<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">This command runs an Ubuntu container, installs Nginx, and exposes port 80 in the container as port 8080 on the host.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Exposing Multiple Ports<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">You can expose multiple ports by specifying additional -p flags:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -d -p 8080:80 -p 443:443 ubuntu  -c &#8220;apt update &amp;&amp; apt install -y nginx &amp;&amp; nginx -g &#8216;daemon off;'&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">wasm<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">b67f7d89253a4e8f0b5f64dcb9f2f1d542973fbbce73e7cdd6729b35e0d1125c<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>7. How to Create a Network<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Creating a custom network allows you to isolate containers and manage their communication.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Creating a Network<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">To create a new network:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman network create mynetwork<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">mynetwork<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">This command creates a new network named mynetwork.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Running a Container on a Custom Network<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -d &#8211;network mynetwork ubuntu  -c &#8220;apt update &amp;&amp; apt install -y nginx &amp;&amp; nginx -g &#8216;daemon off;'&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">1e0d2fdb110c8e3b6f2f4f5462d1c9b99e9c47db2b16da6b2de1e4d9275c2a50<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">This container will now communicate with others on the mynetwork network.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>8. How to Connect a Network Between Pods<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Podman allows you to manage pods, which are groups of containers sharing the same network namespace.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Creating a Pod and Adding Containers<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman pod create mypod<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -dt &#8211;pod mypod ubuntu  -c &#8220;apt update &amp;&amp; apt install -y nginx &amp;&amp; nginx -g &#8216;daemon off;'&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -dt &#8211;pod mypod ubuntu  -c &#8220;apt update &amp;&amp; apt install -y redis-server &amp;&amp; redis-server&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">f04d1c28b030f24f3f7b91f9f68d07fe1e6a2d81caeb60c356c64b3f7f7412c7<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">8cf540eb8e1b0566c65886c684017d5367f2a167d82d7b3b8c3496cbd763d447<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">4f3402b31e20a07f545dbf69cb4e1f61290591df124bdaf736de64bc3d40d4b1<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Both containers now share the same network namespace and can communicate over the mypod network.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Connecting Pods to a Network<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">To connect a pod to an existing network:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman pod create &#8211;network mynetwork mypod<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">f04d1c28b030f24f3f7b91f9f68d07fe1e6a2d81caeb60c356c64b3f7f7412c7<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">This pod will use the mynetwork network, allowing communication with other containers on that network.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>9. How to Inspect a Network<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Inspecting a network provides detailed information about the network configuration and connected containers.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Inspecting a Network<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Use the podman network inspect command:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman network inspect mynetwork<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">json<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">[<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">    {<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;name&#8221;: &#8220;mynetwork&#8221;,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;id&#8221;: &#8220;3c0d6e2eaf3c4f3b98a71c86f7b35d10b9d4f7b749b929a6d758b3f76cd1f8c6&#8221;,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;driver&#8221;: &#8220;bridge&#8221;,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;network_interface&#8221;: &#8220;cni-podman0&#8221;,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;created&#8221;: &#8220;2024-08-12T08:45:24.903716327Z&#8221;,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;subnets&#8221;: [<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">            {<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">                &#8220;subnet&#8221;: &#8220;10.88.1.0\/24&#8221;,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">                &#8220;gateway&#8221;: &#8220;10.88.1.1&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">            }<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        ],<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;ipv6_enabled&#8221;: false,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;internal&#8221;: false,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;dns_enabled&#8221;: true,<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        &#8220;network_dns_servers&#8221;: [<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">            &#8220;8.8.8.8&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">        ]<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">    }<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">]<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">This command will display detailed JSON output, including network interfaces, IP ranges, and connected containers.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>10. How to Add a Static Address<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Assigning a static IP address can be necessary for consistent network configurations.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Assigning a Static IP<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">When running a container, you can assign it a static IP address within a custom network:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -d &#8211;network mynetwork &#8211;ip 10.88.1.100 ubuntu  -c &#8220;apt update &amp;&amp; apt install -y nginx &amp;&amp; nginx -g &#8216;daemon off;'&#8221;<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">f05c2f18e41b4ef3a76a7b2349db20c10d9f2ff09f8c676eb08e9dc92f87c216<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Ensure that the IP address is within the subnet range of your custom network.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>11. How to Log On to a Container with <\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Accessing a container&#8217;s shell is often necessary for debugging or managing running applications.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Starting a Container with <\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">If the container image includes , you can start it directly:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman run -it ubuntu <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">ruby<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">root@e87b469f2e45:\/#<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Accessing a Running Container<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">To access an already running container:<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">podman exec -it &lt;container_id&gt; <\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">Replace &lt;container_id&gt; with the actual ID or name of the container.<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><strong>Example Output:<\/strong><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">ruby<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\">root@d2f56a8d1234:\/#<\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"background:#a0a0a0;width:0;height:1.5pt;display:inline-block;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top:0pt;padding-top:0;margin-bottom:8pt;padding-bottom:0;line-height:1.3;\"><span style=\"display:inline-block;height:1em;\"><span style=\"display:none;\">.<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mastering Podman on Ubuntu: A Comprehensive Guide with Detailed Command Examples Podman has become a popular alternative to Docker due to its flexibility, security, and rootless operation capabilities. This guide will walk you through the installation process and various advanced usage scenarios of Podman on Ubuntu, providing detailed examples for each command. Table of Contents 1.How to Install Podman 2.How<a href=\"https:\/\/nicktailor.com\/tech-blog\/mastering-podman-a-comprehensive-guide-with-detailed-command-examples\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[142],"tags":[],"class_list":["post-1911","post","type-post","status-publish","format-standard","hentry","category-podman"],"_links":{"self":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/comments?post=1911"}],"version-history":[{"count":3,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1911\/revisions"}],"predecessor-version":[{"id":1915,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1911\/revisions\/1915"}],"wp:attachment":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/media?parent=1911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/categories?post=1911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/tags?post=1911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}