b24b4f
% containers-storage.conf(5) Container Storage Configuration File
b24b4f
% Dan Walsh
b24b4f
% May 2017
b24b4f
b24b4f
# NAME
b24b4f
storage.conf - Syntax of Container Storage configuration file
b24b4f
b24b4f
## DESCRIPTION
b24b4f
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.
b24b4f
b24b4f
## FORMAT
b24b4f
The [TOML format][toml] is used as the encoding of the configuration file.
b24b4f
Every option and subtable listed here is nested under a global "storage" table.
b24b4f
No bare options are used. The format of TOML can be simplified to:
b24b4f
b24b4f
    [table]
b24b4f
    option = value
b24b4f
b24b4f
    [table.subtable1]
b24b4f
    option = value
b24b4f
b24b4f
    [table.subtable2]
b24b4f
    option = value
b24b4f
b24b4f
## STORAGE TABLE
b24b4f
b24b4f
The `storage` table supports the following options:
b24b4f
b24b4f
**driver**=""
b24b4f
  container storage driver
b24b4f
  Default 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.
b24b4f
  This field is required to guarantee proper operation.
b24b4f
  Valid rootless drivers are "btrfs", "overlay", and "vfs".
b24b4f
  Rootless users default to the driver defined in the system configuration when possible.
b24b4f
  When the system configuration uses an unsupported rootless driver, rootless users default to "overlay" if available, otherwise "vfs".
b24b4f
b24b4f
**graphroot**=""
b24b4f
  container storage graph dir (default: "/var/lib/containers/storage")
b24b4f
  Default directory to store all writable content created by container storage programs.
b24b4f
  The rootless graphroot path supports environment variable substitutions (ie. `$HOME/containers/storage`)
b24b4f
  When changing the graphroot location on an SELINUX system, ensure
b24b4f
  the labeling matches the default locations labels with the
b24b4f
  following commands:
b24b4f
  
b24b4f
```
b24b4f
# semanage fcontext -a -e /var/lib/containers/storage /NEWSTORAGEPATH
b24b4f
# restorecon -R -v /NEWSTORAGEPATH
b24b4f
```
b24b4f
b24b4f
  In Rootless Mode you would set
b24b4f
b24b4f
```
b24b4f
# semanage fcontext -a -e $HOME/.local/share/containers NEWSTORAGEPATH
b24b4f
$ restorecon -R -v /NEWSTORAGEPATH
b24b4f
```
b24b4f
**rootless_storage_path**="$HOME/.local/share/containers/storage"
b24b4f
  Storage path for rootless users. By default the graphroot for rootless users
b24b4f
  is set to `$XDG_DATA_HOME/containers/storage`, if XDG_DATA_HOME is set.
b24b4f
  Otherwise `$HOME/.local/share/containers/storage` is used.  This field can
b24b4f
  be used if administrators need to change the storage location for all users.
b24b4f
  The rootless storage path supports environment variable substitutions (ie. `$HOME/containers/storage`)
b24b4f
b24b4f
  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).
b24b4f
b24b4f
**runroot**=""
b24b4f
  container storage run dir (default: "/run/containers/storage")
b24b4f
  Default directory to store all temporary writable content created by container storage programs.
b24b4f
  The rootless runroot path supports environment variable substitutions (ie. `$HOME/containers/storage`)
b24b4f
b24b4f
### STORAGE OPTIONS TABLE
b24b4f
b24b4f
The `storage.options` table supports the following options:
b24b4f
b24b4f
**additionalimagestores**=[]
b24b4f
  Paths to additional container image stores. Usually these are read/only and stored on remote network shares.
b24b4f
b24b4f
**remap-uids=**""
b24b4f
**remap-gids=**""
b24b4f
  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.
b24b4f
b24b4f
  Example
b24b4f
     remap-uids = 0:1668442479:65536
b24b4f
     remap-gids = 0:1668442479:65536
b24b4f
b24b4f
  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.
b24b4f
b24b4f
**remap-user**=""
b24b4f
**remap-group**=""
b24b4f
  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.
b24b4f
b24b4f
  Example
b24b4f
     remap-user = "containers"
b24b4f
     remap-group = "containers"
b24b4f
b24b4f
**root-auto-userns-user**=""
b24b4f
  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.
b24b4f
b24b4f
**auto-userns-min-size**=1024
b24b4f
  Auto-userns-min-size is the minimum size for a user namespace created automatically.
b24b4f
b24b4f
**auto-userns-max-size**=65536
b24b4f
  Auto-userns-max-size is the maximum size for a user namespace created automatically.
b24b4f
b24b4f
**disable-volatile**=true
b24b4f
  If disable-volatile is set, then the "volatile" mount optimization is disabled for all the containers.
b24b4f
b24b4f
### STORAGE OPTIONS FOR AUFS TABLE
b24b4f
b24b4f
The `storage.options.aufs` table supports the following options:
b24b4f
b24b4f
**mountopt**=""
b24b4f
  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.
b24b4f
b24b4f
### STORAGE OPTIONS FOR BTRFS TABLE
b24b4f
b24b4f
The `storage.options.btrfs` table supports the following options:
b24b4f
b24b4f
**min_space**=""
b24b4f
  Specifies the min space in a btrfs volume.
b24b4f
b24b4f
**size**=""
b24b4f
  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))
b24b4f
b24b4f
### STORAGE OPTIONS FOR THINPOOL (devicemapper) TABLE
b24b4f
b24b4f
The `storage.options.thinpool` table supports the following options for the `devicemapper` driver:
b24b4f
b24b4f
**autoextend_percent**=""
b24b4f
  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%)
b24b4f
b24b4f
**autoextend_threshold**=""
b24b4f
  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%)
b24b4f
b24b4f
**basesize**=""
b24b4f
  Specifies the size to use when creating the base device, which limits the size of images and containers. (default: 10g)
b24b4f
b24b4f
**blocksize**=""
b24b4f
  Specifies a custom blocksize to use for the thin pool. (default: 64k)
b24b4f
b24b4f
**directlvm_device**=""
b24b4f
  Specifies a custom block storage device to use for the thin pool. Required for using graphdriver `devicemapper`.
b24b4f
b24b4f
**directlvm_device_force**=""
b24b4f
  Tells driver to wipe device (directlvm_device) even if device already has a filesystem.  (default: false)
b24b4f
b24b4f
**fs**="xfs"
b24b4f
  Specifies the filesystem type to use for the base device. (default: xfs)
b24b4f
b24b4f
**log_level**=""
b24b4f
  Sets the log level of devicemapper.
b24b4f
b24b4f
    0: LogLevelSuppress 0 (default)
b24b4f
    2: LogLevelFatal
b24b4f
    3: LogLevelErr
b24b4f
    4: LogLevelWarn
b24b4f
    5: LogLevelNotice
b24b4f
    6: LogLevelInfo
b24b4f
    7: LogLevelDebug
b24b4f
b24b4f
**metadata_size**=""
b24b4f
  metadata_size is used to set the `pvcreate --metadatasize` options when creating thin devices. (Default 128k)
b24b4f
b24b4f
**min_free_space**=""
b24b4f
  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%)
b24b4f
b24b4f
**mkfsarg**=""
b24b4f
  Specifies extra mkfs arguments to be used when creating the base device.
b24b4f
b24b4f
**mountopt**=""
b24b4f
  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.
b24b4f
b24b4f
**size**=""
b24b4f
  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))
b24b4f
b24b4f
**use_deferred_deletion**=""
b24b4f
  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).
b24b4f
b24b4f
**use_deferred_removal**=""
b24b4f
  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).
b24b4f
b24b4f
**xfs_nospace_max_retries**=""
b24b4f
  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.)
b24b4f
b24b4f
### STORAGE OPTIONS FOR OVERLAY TABLE
b24b4f
b24b4f
The `storage.options.overlay` table supports the following options:
b24b4f
b24b4f
**ignore_chown_errors** = "false"
b24b4f
  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)
b24b4f
b24b4f
**inodes**=""
b24b4f
  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.
b24b4f
b24b4f
**force_mask** = "0000|shared|private"
b24b4f
  ForceMask specifies the permissions mask that is used for new files and
b24b4f
directories.
b24b4f
The values "shared" and "private" are accepted.  (default: ""). Octal permission
b24b4f
masks are also accepted.
b24b4f
b24b4f
  ``: Not set
b24b4f
     All files/directories, get set with the permissions identified within the
b24b4f
image.
b24b4f
b24b4f
  `private`: it is equivalent to 0700.
b24b4f
     All files/directories get set with 0700 permissions.  The owner has rwx
b24b4f
access to the files. No other users on the system can access the files.
b24b4f
This setting could be used with networked based home directories.
b24b4f
b24b4f
  `shared`: it is equivalent to 0755.
b24b4f
     The owner has rwx access to the files and everyone else can read, access
b24b4f
and execute them. This setting is useful for sharing containers storage
b24b4f
with other users.  For instance, a storage owned by root could be shared
b24b4f
to rootless users as an additional store.
b24b4f
NOTE:  All files within the image are made readable and executable by any
b24b4f
user on the system. Even /etc/shadow within your image is now readable by
b24b4f
any user.
b24b4f
b24b4f
  `OCTAL`: Users can experiment with other OCTAL Permissions.
b24b4f
b24b4f
Note: The force_mask Flag is an experimental feature, it could change in the
b24b4f
future.  When "force_mask" is set the original permission mask is stored in the
b24b4f
"user.containers.override_stat" xattr and the "mount_program" option must be
b24b4f
specified. Mount programs like "/usr/bin/fuse-overlayfs" present the extended
b24b4f
attribute permissions to processes within containers rather then the
b24b4f
"force_mask"  permissions.
b24b4f
b24b4f
**mount_program**=""
b24b4f
  Specifies the path to a custom program to use instead of using kernel defaults
b24b4f
for mounting the file system. In rootless mode, without the CAP_SYS_ADMIN
b24b4f
capability, many kernels prevent mounting of overlay file systems, requiring
b24b4f
you to specify a mount_program. The mount_program option is also required on
b24b4f
systems where the underlying storage is btrfs, aufs, zfs, overlay, or ecryptfs
b24b4f
based file systems.
b24b4f
  mount_program = "/usr/bin/fuse-overlayfs"
b24b4f
b24b4f
**mountopt**=""
b24b4f
  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.
b24b4f
b24b4f
**size**=""
b24b4f
  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))
b24b4f
b24b4f
### STORAGE OPTIONS FOR VFS TABLE
b24b4f
b24b4f
The `storage.options.vfs` table supports the following options:
b24b4f
b24b4f
**ignore_chown_errors** = "false"
b24b4f
  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)
b24b4f
b24b4f
### STORAGE OPTIONS FOR ZFS TABLE
b24b4f
b24b4f
The `storage.options.zfs` table supports the following options:
b24b4f
b24b4f
**fsname**=""
b24b4f
  File System name for the zfs driver
b24b4f
b24b4f
**mountopt**=""
b24b4f
  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.
b24b4f
b24b4f
**skip_mount_home=""**
b24b4f
  Tell storage drivers to not create a PRIVATE bind mount on their home directory.
b24b4f
b24b4f
**size**=""
b24b4f
  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))
b24b4f
b24b4f
## SELINUX LABELING
b24b4f
b24b4f
When running on an SELinux system, if you move the containers storage graphroot directory, you must make sure the labeling is correct.
b24b4f
b24b4f
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`.
b24b4f
b24b4f
```
b24b4f
semanage fcontext -a -e /var/lib/containers NEWSTORAGEPATH
b24b4f
restorecon -R -v NEWSTORAGEPATH
b24b4f
```
b24b4f
b24b4f
In rootless mode, you would set
b24b4f
b24b4f
```
b24b4f
semanage fcontext -a -e $HOME/.local/share/containers NEWSTORAGEPATH
b24b4f
restorecon -R -v NEWSTORAGEPATH
b24b4f
```
b24b4f
b24b4f
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.
b24b4f
b24b4f
Now all new content created in these directories will automatically be created with the correct label.
b24b4f
b24b4f
## QUOTAS
b24b4f
b24b4f
Container storage implements `XFS project quota controls` for overlay storage
b24b4f
containers and volumes. The directory used to store the containers must be an
b24b4f
`XFS` file system and be mounted with the `pquota` option.
b24b4f
b24b4f
Example /etc/fstab entry:
b24b4f
```
b24b4f
/dev/podman/podman-var /var xfs defaults,x-systemd.device-timeout=0,pquota 1 2
b24b4f
```
b24b4f
b24b4f
Container storage generates project ids for each container and builtin volume, but these project ids need to be unique for the XFS file system.
b24b4f
b24b4f
The xfs_quota tool can be used to assign a project id to the storage driver directory, e.g.:
b24b4f
b24b4f
```
b24b4f
echo 100000:/var/lib/containers/storage/overlay >> /etc/projects
b24b4f
echo 200000:/var/lib/containers/storage/volumes >> /etc/projects
b24b4f
echo storage:100000 >> /etc/projid
b24b4f
echo volumes:200000 >> /etc/projid
b24b4f
xfs_quota -x -c 'project -s storage volumes' /<xfs mount point>
b24b4f
```
b24b4f
b24b4f
In the example above, the storage directory project id will be used as a "start offset"
b24b4f
and all containers will be assigned larger project ids (e.g. >= 100000).
b24b4f
Then the volumes directory project id will be used as a "start offset"
b24b4f
and all volumes will be assigned larger project ids (e.g. >= 200000).
b24b4f
This is a way to prevent xfs_quota management from conflicting with containers/storage.
b24b4f
b24b4f
## FILES
b24b4f
b24b4f
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.
b24b4f
b24b4f
Note: The storage.conf file overrides all other strorage.conf files. Container
b24b4f
engines run by users with a storage.conf file in their home directory do not
b24b4f
use options in the system storage.conf files.
b24b4f
b24b4f
/etc/projects - XFS persistent project root definition
b24b4f
/etc/projid -  XFS project name mapping file
b24b4f
b24b4f
## SEE ALSO
b24b4f
`semanage(8)`, `restorecon(8)`, `mount(8)`, `fuse-overlayfs(1)`, `xfs_quota(8)`, `projects(5)`, `projid(5)`
b24b4f
b24b4f
## HISTORY
b24b4f
May 2017, Originally compiled by Dan Walsh <dwalsh@redhat.com>
b24b4f
Format copied from crio.conf man page created by Aleksa Sarai <asarai@suse.de>