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