fa61e0
% containers-storage.conf(5) Container Storage Configuration File
fa61e0
% Dan Walsh
fa61e0
% May 2017
fa61e0
fa61e0
# NAME
fa61e0
storage.conf - Syntax of Container Storage configuration file
fa61e0
fa61e0
## DESCRIPTION
fa61e0
The STORAGE configuration file specifies all of the available container storage options for tools using shared container storage, but in a TOML format that can be more easily modified and versioned.
fa61e0
fa61e0
## FORMAT
fa61e0
The [TOML format][toml] is used as the encoding of the configuration file.
fa61e0
Every option and subtable listed here is nested under a global "storage" table.
fa61e0
No bare options are used. The format of TOML can be simplified to:
fa61e0
fa61e0
    [table]
fa61e0
    option = value
fa61e0
fa61e0
    [table.subtable1]
fa61e0
    option = value
fa61e0
fa61e0
    [table.subtable2]
fa61e0
    option = value
fa61e0
fa61e0
## STORAGE TABLE
fa61e0
fa61e0
The `storage` table supports the following options:
fa61e0
fa61e0
**driver**=""
7d010a
  Copy On Write (COW) container storage driver. Valid drivers are "overlay", "vfs", "devmapper", "aufs", "btrfs", and "zfs". Some drivers (for example, "zfs", "btrfs", and "aufs") may not work if your kernel lacks support for the filesystem.
7d010a
This field is required to guarantee proper operation.
7d010a
Valid rootless drivers are "btrfs", "overlay", and "vfs".
7d010a
Rootless users default to the driver defined in the system configuration when possible.
7d010a
When the system configuration uses an unsupported rootless driver, rootless users default to "overlay" if available, otherwise "vfs".
fa61e0
fa61e0
**graphroot**=""
fa61e0
  container storage graph dir (default: "/var/lib/containers/storage")
7d010a
Default directory to store all writable content created by container storage programs.
7d010a
The rootless graphroot path supports environment variable substitutions (ie. `$HOME/containers/storage`).
7d010a
When changing the graphroot location on an SELINUX system, ensure the labeling matches the default locations labels with the following commands:
462880
0106cf
```
0106cf
# semanage fcontext -a -e /var/lib/containers/storage /NEWSTORAGEPATH
0106cf
# restorecon -R -v /NEWSTORAGEPATH
0106cf
```
0106cf
7d010a
In rootless mode you would set
fa61e0
0106cf
```
0106cf
# semanage fcontext -a -e $HOME/.local/share/containers NEWSTORAGEPATH
0106cf
$ restorecon -R -v /NEWSTORAGEPATH
0106cf
```
fa61e0
**rootless_storage_path**="$HOME/.local/share/containers/storage"
7d010a
  Storage path for rootless users. By default the graphroot for rootless users is set to `$XDG_DATA_HOME/containers/storage`, if XDG_DATA_HOME is set. Otherwise `$HOME/.local/share/containers/storage` is used. This field can be used if administrators need to change the storage location for all users. The rootless storage path supports environment variable substitutions (ie. `$HOME/containers/storage`)
fa61e0
7d010a
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).
fa61e0
fa61e0
**runroot**=""
fa61e0
  container storage run dir (default: "/run/containers/storage")
7d010a
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`)
7d010a
7d010a
**driver_priority**=[]
7d010a
  Priority list for the storage drivers that will be tested one after the other to pick the storage driver if it is not defined. The first storage driver in this list that can be used, will be picked as the new one and all subsequent ones will not be tried. If all drivers in this list are not viable, then **all** known drivers will be tried and the first working one will be picked.
7d010a
By default, the storage driver is set via the `driver` option. If it is not defined, then the best driver will be picked according to the current platform. This option allows you to override this internal priority list with a custom one to prefer certain drivers.
7d010a
Setting this option only has an effect if the local storage has not been initialized yet and the driver name is not set.
fa61e0
fa61e0
### STORAGE OPTIONS TABLE
fa61e0
fa61e0
The `storage.options` table supports the following options:
fa61e0
fa61e0
**additionalimagestores**=[]
fa61e0
  Paths to additional container image stores. Usually these are read/only and stored on remote network shares.
fa61e0
462880
**pull_options** = {enable_partial_images = "false", use_hard_links = "false", ostree_repos=""}
462880
462880
Allows specification of how storage is populated when pulling images. This
462880
option can speed the pulling process of images compressed with format zstd:chunked. Containers/storage looks
462880
for files within images that are being pulled from a container registry that
462880
were previously pulled to the host.  It can copy or create
462880
a hard link to the existing file when it finds them, eliminating the need to pull them from the
462880
container registry. These options can deduplicate pulling of content, disk
462880
storage of content and can allow the kernel to use less memory when running
462880
containers.
462880
462880
containers/storage supports four keys
462880
  * enable_partial_images="true" | "false"
462880
    Tells containers/storage to look for files previously pulled in storage
462880
    rather then always pulling them from the container registry.
462880
  * use_hard_links = "false" | "true"
462880
    Tells containers/storage to use hard links rather then create new files in
462880
    the image, if an identical file already existed in storage.
462880
  * ostree_repos = ""
462880
    Tells containers/storage where an ostree repository exists that might have
462880
    previously pulled content which can be used when attempting to avoid
462880
    pulling content from the container registry
462880
fa61e0
**remap-uids=**""
fa61e0
**remap-gids=**""
fa61e0
  Remap-UIDs/GIDs is the mapping from UIDs/GIDs as they should appear inside of a container, to the UIDs/GIDs outside of the container, and the length of the range of UIDs/GIDs.  Additional mapped sets can be listed and will be heeded by libraries, but there are limits to the number of mappings which the kernel will allow when you later attempt to run a container.
fa61e0
fa61e0
  Example
fa61e0
     remap-uids = 0:1668442479:65536
fa61e0
     remap-gids = 0:1668442479:65536
fa61e0
fa61e0
  These mappings tell the container engines to map UID 0 inside of the container to UID 1668442479 outside.  UID 1 will be mapped to 1668442480. UID 2 will be mapped to 1668442481, etc, for the next 65533 UIDs in succession.
fa61e0
fa61e0
**remap-user**=""
fa61e0
**remap-group**=""
fa61e0
  Remap-User/Group is a user name which can be used to look up one or more UID/GID ranges in the /etc/subuid or /etc/subgid file.  Mappings are set up starting with an in-container ID of 0 and then a host-level ID taken from the lowest range that matches the specified name, and using the length of that range. Additional ranges are then assigned, using the ranges which specify the lowest host-level IDs first, to the lowest not-yet-mapped in-container ID, until all of the entries have been used for maps.
fa61e0
fa61e0
  Example
fa61e0
     remap-user = "containers"
fa61e0
     remap-group = "containers"
fa61e0
fa61e0
**root-auto-userns-user**=""
fa61e0
  Root-auto-userns-user is a user name which can be used to look up one or more UID/GID ranges in the /etc/subuid and /etc/subgid file.  These ranges will be partitioned to containers configured to create automatically a user namespace.  Containers configured to automatically create a user namespace can still overlap with containers having an explicit mapping set.  This setting is ignored when running as rootless.
fa61e0
fa61e0
**auto-userns-min-size**=1024
fa61e0
  Auto-userns-min-size is the minimum size for a user namespace created automatically.
fa61e0
fa61e0
**auto-userns-max-size**=65536
fa61e0
  Auto-userns-max-size is the maximum size for a user namespace created automatically.
fa61e0
fa61e0
**disable-volatile**=true
fa61e0
  If disable-volatile is set, then the "volatile" mount optimization is disabled for all the containers.
fa61e0
fa61e0
### STORAGE OPTIONS FOR AUFS TABLE
fa61e0
fa61e0
The `storage.options.aufs` table supports the following options:
fa61e0
fa61e0
**mountopt**=""
fa61e0
  Comma separated list of default options to be used to mount container images.  Suggested value "nodev". Mount options are documented in the mount(8) man page.
fa61e0
fa61e0
### STORAGE OPTIONS FOR BTRFS TABLE
fa61e0
fa61e0
The `storage.options.btrfs` table supports the following options:
fa61e0
fa61e0
**min_space**=""
fa61e0
  Specifies the min space in a btrfs volume.
fa61e0
fa61e0
**size**=""
fa61e0
  Maximum size of a container image.   This flag can be used to set quota on the size of container images. (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
fa61e0
fa61e0
### STORAGE OPTIONS FOR THINPOOL (devicemapper) TABLE
fa61e0
fa61e0
The `storage.options.thinpool` table supports the following options for the `devicemapper` driver:
fa61e0
fa61e0
**autoextend_percent**=""
fa61e0
  Tells the thinpool driver the amount by which the thinpool needs to be grown. This is specified in terms of % of pool size. So a value of 20 means that when threshold is hit, pool will be grown by 20% of existing pool size. (default: 20%)
fa61e0
fa61e0
**autoextend_threshold**=""
fa61e0
  Tells the driver the thinpool extension threshold in terms of percentage of pool size. For example, if threshold is 60, that means when pool is 60% full, threshold has been hit. (default: 80%)
fa61e0
fa61e0
**basesize**=""
fa61e0
  Specifies the size to use when creating the base device, which limits the size of images and containers. (default: 10g)
fa61e0
fa61e0
**blocksize**=""
fa61e0
  Specifies a custom blocksize to use for the thin pool. (default: 64k)
fa61e0
fa61e0
**directlvm_device**=""
fa61e0
  Specifies a custom block storage device to use for the thin pool. Required for using graphdriver `devicemapper`.
fa61e0
fa61e0
**directlvm_device_force**=""
fa61e0
  Tells driver to wipe device (directlvm_device) even if device already has a filesystem.  (default: false)
fa61e0
fa61e0
**fs**="xfs"
fa61e0
  Specifies the filesystem type to use for the base device. (default: xfs)
fa61e0
fa61e0
**log_level**=""
fa61e0
  Sets the log level of devicemapper.
fa61e0
fa61e0
    0: LogLevelSuppress 0 (default)
fa61e0
    2: LogLevelFatal
fa61e0
    3: LogLevelErr
fa61e0
    4: LogLevelWarn
fa61e0
    5: LogLevelNotice
fa61e0
    6: LogLevelInfo
fa61e0
    7: LogLevelDebug
fa61e0
fa61e0
**metadata_size**=""
fa61e0
  metadata_size is used to set the `pvcreate --metadatasize` options when creating thin devices. (Default 128k)
fa61e0
fa61e0
**min_free_space**=""
fa61e0
  Specifies the min free space percent in a thin pool required for new device creation to succeed. Valid values are from 0% - 99%. Value 0% disables. (default: 10%)
fa61e0
fa61e0
**mkfsarg**=""
fa61e0
  Specifies extra mkfs arguments to be used when creating the base device.
fa61e0
fa61e0
**mountopt**=""
fa61e0
  Comma separated list of default options to be used to mount container images.  Suggested value "nodev". Mount options are documented in the mount(8) man page.
fa61e0
fa61e0
**size**=""
fa61e0
  Maximum size of a container image.  This flag can be used to set quota on the size of container images. (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
fa61e0
fa61e0
**use_deferred_deletion**=""
fa61e0
  Marks thinpool device for deferred deletion. If the thinpool is in use when the driver attempts to delete it, the driver will attempt to delete device every 30 seconds until successful, or when it restarts.  Deferred deletion permanently deletes the device and all data stored in the device will be lost. (default: true).
fa61e0
fa61e0
**use_deferred_removal**=""
fa61e0
  Marks devicemapper block device for deferred removal.  If the device is in use when its driver attempts to remove it, the driver tells the kernel to remove the device as soon as possible.  Note this does not free up the disk space, use deferred deletion to fully remove the thinpool.  (default: true).
fa61e0
fa61e0
**xfs_nospace_max_retries**=""
fa61e0
  Specifies the maximum number of retries XFS should attempt to complete IO when ENOSPC (no space) error is returned by underlying storage device. (default: 0, which means to try continuously.)
fa61e0
fa61e0
### STORAGE OPTIONS FOR OVERLAY TABLE
fa61e0
fa61e0
The `storage.options.overlay` table supports the following options:
fa61e0
fa61e0
**ignore_chown_errors** = "false"
fa61e0
  ignore_chown_errors can be set to allow a non privileged user running with a  single UID within a user namespace to run containers. The user can pull and use any image even those with multiple uids.  Note multiple UIDs will be squashed down to the default uid in the container.  These images will have no separation between the users in the container. (default: false)
fa61e0
fa61e0
**inodes**=""
fa61e0
  Maximum inodes in a read/write layer.   This flag can be used to set a quota on the inodes allocated for a read/write layer of a container.
fa61e0
fa61e0
**force_mask** = "0000|shared|private"
fa61e0
  ForceMask specifies the permissions mask that is used for new files and
7d010a
directories. The values "shared" and "private" are accepted.  (default: ""). Octal permission
fa61e0
masks are also accepted.
fa61e0
7d010a
- ``: Not set
7d010a
  All files/directories, get set with the permissions identified within the
fa61e0
image.
fa61e0
7d010a
- `private`: it is equivalent to 0700.
7d010a
  All files/directories get set with 0700 permissions.  The owner has rwx
fa61e0
access to the files. No other users on the system can access the files.
fa61e0
This setting could be used with networked based home directories.
fa61e0
7d010a
- `shared`: it is equivalent to 0755.
7d010a
  The owner has rwx access to the files and everyone else can read, access
fa61e0
and execute them. This setting is useful for sharing containers storage
fa61e0
with other users.  For instance, a storage owned by root could be shared
fa61e0
to rootless users as an additional store.
fa61e0
NOTE:  All files within the image are made readable and executable by any
fa61e0
user on the system. Even /etc/shadow within your image is now readable by
fa61e0
any user.
fa61e0
fa61e0
  `OCTAL`: Users can experiment with other OCTAL Permissions.
fa61e0
fa61e0
Note: The force_mask Flag is an experimental feature, it could change in the
fa61e0
future.  When "force_mask" is set the original permission mask is stored in the
fa61e0
"user.containers.override_stat" xattr and the "mount_program" option must be
fa61e0
specified. Mount programs like "/usr/bin/fuse-overlayfs" present the extended
7d010a
attribute permissions to processes within containers rather than the
fa61e0
"force_mask"  permissions.
fa61e0
fa61e0
**mount_program**=""
fa61e0
  Specifies the path to a custom program to use instead of using kernel defaults
fa61e0
for mounting the file system. In rootless mode, without the CAP_SYS_ADMIN
fa61e0
capability, many kernels prevent mounting of overlay file systems, requiring
fa61e0
you to specify a mount_program. The mount_program option is also required on
fa61e0
systems where the underlying storage is btrfs, aufs, zfs, overlay, or ecryptfs
fa61e0
based file systems.
fa61e0
  mount_program = "/usr/bin/fuse-overlayfs"
fa61e0
fa61e0
**mountopt**=""
fa61e0
  Comma separated list of default options to be used to mount container images.  Suggested value "nodev". Mount options are documented in the mount(8) man page.
fa61e0
462880
**skip_mount_home=""**
462880
  Tell storage drivers to not create a PRIVATE bind mount on their home directory.
462880
fa61e0
**size**=""
fa61e0
  Maximum size of a read/write layer.   This flag can be used to set quota on the size of a read/write layer of a container. (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
fa61e0
fa61e0
### STORAGE OPTIONS FOR VFS TABLE
fa61e0
fa61e0
The `storage.options.vfs` table supports the following options:
fa61e0
fa61e0
**ignore_chown_errors** = "false"
fa61e0
  ignore_chown_errors can be set to allow a non privileged user running with a  single UID within a user namespace to run containers. The user can pull and use any image even those with multiple uids.  Note multiple UIDs will be squashed down to the default uid in the container.  These images will have no separation between the users in the container. (default: false)
fa61e0
fa61e0
### STORAGE OPTIONS FOR ZFS TABLE
fa61e0
fa61e0
The `storage.options.zfs` table supports the following options:
fa61e0
fa61e0
**fsname**=""
fa61e0
  File System name for the zfs driver
fa61e0
fa61e0
**mountopt**=""
fa61e0
  Comma separated list of default options to be used to mount container images.  Suggested value "nodev". Mount options are documented in the mount(8) man page.
fa61e0
fa61e0
**size**=""
fa61e0
  Maximum size of a container image.   This flag can be used to set quota on the size of container images. (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes))
fa61e0
fa61e0
## SELINUX LABELING
fa61e0
fa61e0
When running on an SELinux system, if you move the containers storage graphroot directory, you must make sure the labeling is correct.
fa61e0
fa61e0
Tell SELinux about the new containers storage by setting up an equivalence record. This tells SELinux to label content under the new path, as if it was stored under `/var/lib/containers/storage`.
fa61e0
fa61e0
```
fa61e0
semanage fcontext -a -e /var/lib/containers NEWSTORAGEPATH
fa61e0
restorecon -R -v NEWSTORAGEPATH
fa61e0
```
fa61e0
0106cf
In rootless mode, you would set
0106cf
0106cf
```
0106cf
semanage fcontext -a -e $HOME/.local/share/containers NEWSTORAGEPATH
0106cf
restorecon -R -v NEWSTORAGEPATH
0106cf
```
0106cf
fa61e0
The semanage command above tells SELinux to setup the default labeling of `NEWSTORAGEPATH` to match `/var/lib/containers`.  The `restorecon` command tells SELinux to apply the labels to the actual content.
fa61e0
fa61e0
Now all new content created in these directories will automatically be created with the correct label.
fa61e0
fa61e0
## QUOTAS
fa61e0
fa61e0
Container storage implements `XFS project quota controls` for overlay storage
fa61e0
containers and volumes. The directory used to store the containers must be an
fa61e0
`XFS` file system and be mounted with the `pquota` option.
fa61e0
fa61e0
Example /etc/fstab entry:
fa61e0
```
fa61e0
/dev/podman/podman-var /var xfs defaults,x-systemd.device-timeout=0,pquota 1 2
fa61e0
```
fa61e0
fa61e0
Container storage generates project ids for each container and builtin volume, but these project ids need to be unique for the XFS file system.
fa61e0
fa61e0
The xfs_quota tool can be used to assign a project id to the storage driver directory, e.g.:
fa61e0
fa61e0
```
fa61e0
echo 100000:/var/lib/containers/storage/overlay >> /etc/projects
fa61e0
echo 200000:/var/lib/containers/storage/volumes >> /etc/projects
fa61e0
echo storage:100000 >> /etc/projid
fa61e0
echo volumes:200000 >> /etc/projid
fa61e0
xfs_quota -x -c 'project -s storage volumes' /<xfs mount point>
fa61e0
```
fa61e0
fa61e0
In the example above, the storage directory project id will be used as a "start offset"
fa61e0
and all containers will be assigned larger project ids (e.g. >= 100000).
fa61e0
Then the volumes directory project id will be used as a "start offset"
fa61e0
and all volumes will be assigned larger project ids (e.g. >= 200000).
fa61e0
This is a way to prevent xfs_quota management from conflicting with containers/storage.
fa61e0
fa61e0
## FILES
fa61e0
0106cf
Distributions often provide a `/usr/share/containers/storage.conf` file to define default storage configuration. Administrators can override this file by creating `/etc/containers/storage.conf` to specify their own configuration. Likewise rootless users can create a storage.conf file to override the system storage.conf files. Files should be stored in the `$XDG_CONFIG_HOME/containers/storage.conf` file.  If `$XDG_CONFIG_HOME` is not set then the file `$HOME/.config/containers/storage.conf` is used.
0106cf
7d010a
Note: The storage.conf file overrides all other storage.conf files. Container
0106cf
engines run by users with a storage.conf file in their home directory do not
0106cf
use options in the system storage.conf files.
fa61e0
fa61e0
/etc/projects - XFS persistent project root definition
fa61e0
/etc/projid -  XFS project name mapping file
fa61e0
fa61e0
## SEE ALSO
fa61e0
`semanage(8)`, `restorecon(8)`, `mount(8)`, `fuse-overlayfs(1)`, `xfs_quota(8)`, `projects(5)`, `projid(5)`
fa61e0
fa61e0
## HISTORY
fa61e0
May 2017, Originally compiled by Dan Walsh <dwalsh@redhat.com>
fa61e0
Format copied from crio.conf man page created by Aleksa Sarai <asarai@suse.de>