diff --git a/docs/containers-storage.conf.5.md b/docs/containers-storage.conf.5.md index 9d24e54e19..b724cc623e 100644 --- a/docs/containers-storage.conf.5.md +++ b/docs/containers-storage.conf.5.md @@ -56,10 +56,13 @@ $ restorecon -R -v /NEWSTORAGEPATH A common use case for this field is to provide a local storage directory when user home directories are NFS-mounted (podman does not support container storage over NFS). **imagestore**="" + image storage path (default is assumed to be same as `graphroot`). Path of imagestore different from `graphroot`, by default storage library stores all images in `graphroot` but if `imagestore` is provided it will store newly pulled images in provided `imagestore` but will keep using `graphroot` for everything else. If user is using `overlay` driver then images which were already part of `graphroot` will still be accessible ( Internally storage library will mount `graphroot` as an `additionalImageStore` to allow this behaviour ). A common use case for this field is for the users who want to split the file-system in different parts i.e disk which stores images vs disk used by the container created by the image. +Imagestore must be different from `graphroot`. + **runroot**="" container storage run dir (default: "/run/containers/storage") Default directory to store all temporary writable content created by container storage programs. The rootless runroot path supports environment variable substitutions (ie. `$HOME/containers/storage`) diff --git a/storage.conf b/storage.conf index 93a9a236e7..eec744d687 100644 --- a/storage.conf +++ b/storage.conf @@ -27,6 +27,11 @@ runroot = "/run/containers/storage" # restorecon -R -v /NEWSTORAGEPATH graphroot = "/var/lib/containers/storage" +# Optional value for image storage location +# If set must be different than graphroot. + +# imagestore = + # Storage path for rootless users # diff --git a/storage.conf-freebsd b/storage.conf-freebsd index 34d80152c0..92788651ce 100644 --- a/storage.conf-freebsd +++ b/storage.conf-freebsd @@ -22,6 +22,10 @@ runroot = "/var/run/containers/storage" # Primary Read/Write location of container storage graphroot = "/var/db/containers/storage" +# Optional value for image storage location +# If set must be different than graphroot. + +# imagestore = # Storage path for rootless users # diff --git a/types/options.go b/types/options.go index 3ff00ac647..5515802440 100644 --- a/types/options.go +++ b/types/options.go @@ -179,6 +179,10 @@ func defaultStoreOptionsIsolated(rootless bool, rootlessUID int, storageConf str storageOpts.RootlessStoragePath = storagePath } + if storageOpts.ImageStore != "" && storageOpts.ImageStore == storageOpts.GraphRoot { + return storageOpts, fmt.Errorf("imagestore if set must be a different location than graphroot") + } + return storageOpts, nil }