Leia este artigo em português.
If you use Podman to manage containers, at some point, you may need to change the directory where data is stored—whether due to disk space issues or simply to better organize your infrastructure. The good news? It's super easy to do! Let's go! 🚀
📌 Step 1: Editing the Configuration
The first step is to edit the Podman/Docker configuration file. Open the terminal and run:
vim /etc/containers/storage.confNow, look for the [storage] section and edit the graphroot parameter, changing it to the new path where you want to store the data.
⛔ Step 2: Stopping Containers and Clearing Old Data
Before applying the change, we need to pause the containers and clear the old data to avoid conflicts. Run the following commands:
podman ps -a -q | xargs podman stop
podman system resetThis ensures that everything will be initialized correctly with the new path.
🔄 Step 3: Restarting Podman/Docker
Now it's time to restart Podman/Docker so that it starts using the new directory. Run:
systemctl restart podman🔍 Step 4: Verifying the Change
After everything is set up, it’s always good to verify if the change was successfully applied. Run this command:
podman info --format '{{ .Store.GraphRoot }}'If the displayed path matches the one you configured in storage.conf, you're done! 🎉
💡 Who am I?
I’m Gabriel Carmo, a CNCF Kubestronaut holding the CKA, CKAD, CKS, KCNA, and KCSA certifications, as well as Red Hat Certified OpenShift Administrator.
I work in DevOps Engineering, building and evolving multi-cloud Kubernetes platforms. My work focuses on reducing engineering teams’ cognitive load through platform engineering, automation, GitOps, and self-service experiences.
In my daily work, I connect infrastructure as code, cloud networking, governance, security, observability, and SRE practices to build more standardized, resilient, and operable platforms.