Where Does Podman Store Images?

Where Does Podman Store Images?

Podman is an operating-system-level virtualization method that allows building and running Open Containers Initiative (OCI) containers. It is a drop-in replacement for Docker, a popular platform for managing and running containers. Podman is entirely open source, making it the perfect choice for anyone looking to use containerization without the hassle of lock-in and worrying about licensing. In this article, we are specifically going to look at container and image storage properties and options for Podman. In this article, we are going to answer the question of where does Podman store images.

Images vs Containers

It is important to first understand the difference between images and containers. Images are a collection of one or more immutable storage layers that make up a runnable virtual OS and its files and applications. Containers are commonly used to describe a running image which happens by adding a “running” layer to the image where execution happens.1

Where Does Podman Store Images?

Podman conforms to the Open Container Initiative (OCI) which dictates that by default, images should be stored in the /var/lib/containers directory when it is run with the root user, or $HOME/.local/share/containers/storage/ when it is run with a normal user.2 The reason for this separation is to allow multiple standard users to run their containers in parallel without affecting each other. It also allows applying correct permissions to the containers easily since each user’s files are located under their home directories.

It is worth noting that other Podman tools also use the image storage location for their operations, for example, Buildah and Skopeo.

Can I change Podman’s storage location?

Podman’s storage location can be configured by editing the /etc/containers/storage.conf file. This will change the Podman storage settings system-wide. If you want to override these settings on a per-user basis, you can create a new config file under each user that needs to override them at $HOME/.config/containers/storage.conf.3

Here is a sample storage.conf:

[storage]
  driver = "overlay"
  runroot = "/run/user/1000"
  graphroot = "/home/my-user/.local/share/containers/storage"
  [storage.options]
    ...

driver is the storage driver that Podman will use to determine how to store images and containers. Currently, the only driver is overlay which Podman treats as overlay2 since overlay and overlay2 are interchangeable. overlay is supported for XFS, Ext4, and Btrfs assuming there is also kernel support.

runroot is the location where the “running” layer is stored and only exists for the lifetime of the container. If the container is run as root then typically runroot storage location is /var/run/containers/storage.

graphroot is the location where the images are stored. A common use case for changing this is to use a different storage medium such as a secondary mounted disk on the system, or even a mounted NFS drive on the network or cloud.

Depending on the storage driver in use you can specify storage options in the [storage.options] section. Since only overlay is currently the only supported driver, you can specify its options here.

References

  1. Docker Image vs Container – Difference Between Application Deployment Technologies – AWS. (n.d.). Amazon Web Services, Inc. https://aws.amazon.com/compare/the-difference-between-docker-images-and-containers/ ↩︎
  2. September2023. (2023, September 15). Configuring storage for Podman. Oracle Help Center. https://docs.oracle.com/en/operating-systems/oracle-linux/podman/podman-ConfiguringStorageforPodman.html ↩︎
  3. Walsh, D. (2023, January 12). Exploring additional image stores in Podman. Enable Sysadmin. https://www.redhat.com/sysadmin/image-stores-podman ↩︎
Published