Exercise Description:

In this exercise, you are going to learn to deploy a container with a persistent volume, so that the data can be retrieved even if the container gets deleted.

Quick Example:

Step1: pull centos image

Step2: create a local directory called /pages_data

Step3: mounting the local directory to the path of image while running a container using below options

$ podman run -d –name mycentos -v /pages_data/:/data centos

this command will deploy the container with a persistent volume

Step4: Add data inside /pages_data directory

$ touch sample_files{1..5}

Step5: Go inside the container and check data of /pages_data is reflected in the /data directory or not.

$ podman exec -it mycentos bash 

check the /data directory whether data is reflected or not


  • Create a directory /test
  • Create index.html file inside /test directory with some content
  • Run httpd container of name “myhttpd” and  map /test directory with default path of apache (/usr/local/apache2/htdocs)
  • Check  whether is it mounted or not