{"id":88918,"date":"2023-04-13T19:09:34","date_gmt":"2023-04-13T19:09:34","guid":{"rendered":"https:\/\/www.techrepublic.com\/?p=4065969"},"modified":"2023-04-13T19:09:34","modified_gmt":"2023-04-13T19:09:34","slug":"how-to-deploy-a-podman-container-with-persistent-storage","status":"publish","type":"post","link":"https:\/\/cloudnewshub.com\/?p=88918","title":{"rendered":"How to deploy a Podman container with persistent storage"},"content":{"rendered":"<div><img decoding=\"async\" src=\"http:\/\/cloudnewshub.com\/wp-content\/uploads\/2023\/04\/how-to-deploy-a-podman-container-with-persistent-storage.jpg\" class=\"ff-og-image-inserted\"><\/div>\n<div id>\n<p> If you&#8217;re either transitioning to Podman or are new to container development, Jack Wallen shows you how easy it is to deploy a container with persistent storage. <\/p>\n<\/div>\n<div id>\n<p>[embedded content]<\/p>\n<p>Hello, container developers, Jack Wallen here to help you make tech work. If you\u2019re either transitioning to Podman or are new to container development, I want to show you how easy it is to deploy a container with persistent storage. This is a wonderful way of ensuring your work remains available, even if something goes wrong with the container.<\/p>\n<p>What persistent storage means is that we\u2019re mapping a local drive that will house data to the container drive. I\u2019ll demonstrate with the tried and true NGINX web server. To do this, you\u2019ll need a running instance of Podman on a supported OS like Ubuntu Server or Rocky Linux.<\/p>\n<p><strong>SEE:<\/strong> Check out Jack Wallen\u2019s Podman tutorial on <a href=\"https:\/\/www.techrepublic.com\/article\/enable-podman-sudoless-container-management\/\">enabling sudo-less container management<\/a>.<\/p>\n<p>The first thing to do is create a volume that will house the data with the command:<\/p>\n<p><code>podman volume create nginx-volume<\/code><\/p>\n<p>That volume is created in the directory <code>\/home\/USER\/.local\/share\/containers\/storage\/volumes\/nginx-volume\/_data<\/code>, where USER is your Linux username. Next, create a new NGINX index file with the command:<\/p>\n<p><code>nano \/home\/USER\/.local\/share\/containers\/storage\/volumes\/nginx-volume\/_data\/index.html<\/code><\/p>\n<p>Where USER is your Linux username. In that file, paste the following content:<\/p>\n<p><code>&lt;h2&gt;Hello, TechRepublic!&lt;\/h2&gt;<\/code><\/p>\n<p>Save and close the file. We can now deploy our NGINX container and attach it to the newly created volume that contains our index.html file with the command:<\/p>\n<p><code>podman run -d -p 8085:80 -v nginx-volume:\/usr\/share\/nginx\/html --name nginx-volumetest nginx:latest<\/code><\/p>\n<p>Once the container is up and running, you can view the index file by pointing a web browser to http:\/\/SERVER: 8085, where SERVER is the IP address of the hosting server. Make sure to open your firewall to allow port 8085 through, and you\u2019re good to go.<\/p>\n<p>And that\u2019s all there is to deploying an NGINX container with Podman that includes persistent storage.<\/p>\n<p><em><strong>Subscribe to TechRepublic\u2019s <a href=\"https:\/\/www.youtube.com\/channel\/UCKyMiy1zmJ7aZ8aP6DLZLIA\" target=\"_blank\" rel=\"noopener noreferrer\">How To Make Tech Work on YouTube<\/a> for all the latest tech advice for business pros from Jack Wallen.<\/strong><\/em><\/p>\n<p> <!-- default newsletter at the end --> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re either transitioning to Podman or are new to container development, Jack Wallen shows you how easy it is to deploy a container with persistent storage. [embedded content] Hello, container developers, Jack Wallen here to help you make tech work. If you\u2019re either transitioning to Podman or are new to container development, I want [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,783,315,177,155],"tags":[],"class_list":["post-88918","post","type-post","status-publish","format-standard","hentry","category-cloud","category-cloudsync","category-containers","category-open-source","category-storage"],"_links":{"self":[{"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=\/wp\/v2\/posts\/88918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88918"}],"version-history":[{"count":0,"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=\/wp\/v2\/posts\/88918\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudnewshub.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}