CRI-O: Configurable image volume support

Mrunal Patel
cri-o
Published in
1 min readAug 3, 2017

--

Upstream docker allows you to specify a “built-in” VOLUME in an image and it provides a volume for your container when it is run. The content directory for this volume is created on the host under the /var/lib/docker/volumes directory. However, when one tries to use built-in VOLUMEs in kubernetes, there is no guarantee that the data will be persisted. kubernetes has rich support for various kinds of volumes and it is best to use one of those types for your application.

The question becomes how should a container runtime handle image VOLUMEs in k8s. We added support in cri-o to allow cluster administrators to choose what they want to do with such volumes. The three supported options are:

  1. ignore: cri-o ignores all VOLUMEs and print warnings in the log.
  2. mkdir: cri-o creates a directory for the VOLUME in the container’s root filesystem.
  3. bind: cri-o bind mounts a directory for the VOLUME.

To use this feature, pass the flag --image-volumes=(ignore|mkdir|bind)to the cri-o daemon command line or configure it in your /etc/crio/crio.conf file by changing theimage_volumesproperty under the [crio.image]section of the file. The default setting ismkdir.

--

--