When you’re both transitioning to Podman or are new to container improvement, Jack Wallen exhibits you the way straightforward it’s to deploy a container with persistent storage.
Good day, container builders, Jack Wallen right here that can assist you make tech work. When you’re both transitioning to Podman or are new to container improvement, I wish to present you the way straightforward it’s to deploy a container with persistent storage. It is a fantastic means of making certain your work stays accessible, even when one thing goes fallacious with the container.
What persistent storage means is that we’re mapping an area drive that may home information to the container drive. I’ll reveal with the tried and true NGINX internet server. To do that, you’ll want a operating occasion of Podman on a supported OS like Ubuntu Server or Rocky Linux.
SEE: Try Jack Wallen’s Podman tutorial on enabling sudo-less container administration.
The very first thing to do is create a quantity that may home the info with the command:
podman quantity create nginx-volume
That quantity is created within the listing
/house/USER/.native/share/containers/storage/volumes/nginx-volume/_data, the place USER is your Linux username. Subsequent, create a brand new NGINX index file with the command:
The place USER is your Linux username. In that file, paste the next content material:
<h2>Good day, TechRepublic!</h2>
Save and shut the file. We will now deploy our NGINX container and fix it to the newly created quantity that accommodates our index.html file with the command:
podman run -d -p 8085:80 -v nginx-volume:/usr/share/nginx/html --name nginx-volumetest nginx:newest
As soon as the container is up and operating, you’ll be able to view the index file by pointing an online browser to http://SERVER: 8085, the place SERVER is the IP tackle of the internet hosting server. Make sure that to open your firewall to permit port 8085 by, and also you’re good to go.
And that’s all there may be to deploying an NGINX container with Podman that features persistent storage.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the most recent tech recommendation for enterprise execs from Jack Wallen.