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