Quick News Bit

How to deploy a Podman container with persistent storage

0

If you’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.

Hello, container developers, Jack Wallen here to help you make tech work. If you’re 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.

What persistent storage means is that we’re mapping a local drive that will house data to the container drive. I’ll demonstrate with the tried and true NGINX web server. To do this, you’ll need a running instance of Podman on a supported OS like Ubuntu Server or Rocky Linux.

SEE: Check out Jack Wallen’s Podman tutorial on enabling sudo-less container management.

The first thing to do is create a volume that will house the data with the command:

podman volume create nginx-volume

That volume is created in the directory /home/USER/.local/share/containers/storage/volumes/nginx-volume/_data, where USER is your Linux username. Next, create a new NGINX index file with the command:

nano /home/USER/.local/share/containers/storage/volumes/nginx-volume/_data/index.html

Where USER is your Linux username. In that file, paste the following content:

<h2>Hello, TechRepublic!</h2>

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:

podman run -d -p 8085:80 -v nginx-volume:/usr/share/nginx/html --name nginx-volumetest nginx:latest

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’re good to go.

And that’s all there is to deploying an NGINX container with Podman that includes persistent storage.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

For all the latest Technology News Click Here 

 For the latest news and updates, follow us on Google News

Read original article here

Denial of responsibility! NewsBit.us is an automatic aggregator around the global media. All the content are available free on Internet. We have just arranged it in one platform for educational purpose only. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials on our website, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment