ObjectiveFS Docker Volume Plugin

The ObjectiveFS Docker volume plugin lets you use your ObjectiveFS filesystem inside Docker containers. This document describes the steps to create and use an ObjectiveFS docker volume.

Download

I. Prerequisite

  1. Both ObjectiveFS and the ObjectiveFS Docker volume plugin packages are installed.
    a. CentOS/RedHat:

      # yum install docker
      # yum install objectivefs-6.7.1-1.x86_64.rpm
      # yum install objectivefs-docker-volume-1.0-1.x86_64.rpm
      # service objectivefs-docker-volume start
      # service docker start
    b. Ubuntu:
      # apt install docker.io
      # apt install ./objectivefs_6.7.1_amd64.deb
      # apt install ./objectivefs-docker-volume_1.0_amd64.deb
      # service objectivefs-docker-volume start

  2. An ObjectiveFS filesystem has been created (see get started).

  3. [If not using systemd] Run the driver directly, preferably as a daemon.
    # /usr/lib/docker/objectivefs-docker-volume

II. Different ways to create and use the ObjectiveFS Docker Volume

A. Create a Docker Volume on EC2 instances with IAM role attached

  1. Create a volume plugin called ofsvol1 with your filesystem name, license key and filesystem passphrase.

    # docker volume create –driver=objectivefs ofsvol1 -ofs=<filesystem name> -oOBJECTIVEFS_LICENSE=<license> -oOBJECTIVEFS_PASSPHRASE=<fs passphrase> -ooptions=<mount options>

  2. Mount the ofsvol1 volume on dir inside the container.

    # docker run -it -v ofsvol1:<dir> busybox /bin/sh

B. Create a Docker Volume with Keys

  1. Create a volume plugin called ofsvol2 with your filesystem name, license key, filesystem passphrase and AWS keys.

    # docker volume create –driver=objectivefs ofsvol2 -ofs=<filesystem name> -oOBJECTIVEFS_LICENSE=<license> -oOBJECTIVEFS_PASSPHRASE=<fs passphrase> -oAWS_ACCESS_KEY_ID=<aws access key> -oAWS_SECRET_ACCESS_KEY=<secret key> -ooptions=<mount options>

  2. Mount the ofsvol2 volume on dir inside the container.

    # docker run -it -v ofsvol2:<dir> busybox /bin/sh

C. Create a Docker Volume with /etc/objectivefs.env

  1. Check that /etc/objectivefs.env/ contains your license key, filesystem passphrase and AWS keys. The AWS keys are not needed if you are using IAM role.
    Note: You can also have other ObjectiveFS environment variable in this directory such as CACHESIZE and they will also be used by the plugin.

    # ls /etc/objectivefs.env/
    AWS_ACCESS_KEY_ID      OBJECTIVEFS_PASSPHRASE
    AWS_SECRET_ACCESS_KEY  OBJECTIVEFS_LICENSE
    

  2. Create a volume plugin called ofsvol3 with your filesystem name and mount options.

    # docker volume create –driver=objectivefs ofsvol2 -ofs=<filesystem name> -ooptions=<mount options>

  3. Mount the ofsvol3 volume on dir inside the container.

    # docker run -it -v ofsvol3:<dir> busybox /bin/sh

III. Volume Plug In Details and Options

Usage:

# docker volume create \  
  --driver=objectivefs <docker vol id> \  
  -ofs=<filesystem name> \  
  [-o<OBJECTIVEFS_ENV_VAR>=<value>] \  
  [-ooptions=<mount options>] \  
  [-oasap]

  1. ObjectiveFS environment variables can be set using -o<OBJECTIVEFS_ENV_VAR>=<value>.
  2. These environment variables can also be set up in /etc/objectivefs.env/.
  3. The filesystem mount options such as mt, noatime can be set in the mount options field.
  4. Multiple mount options can be set on the same line separated by commas, e.g. -ooptions=mt,noatime.
  5. The -oasap option will unmount the filesystem as soon as there is no running container using the volume. Normally, the filesystem is unmounted when the volume is removed.
  6. The -oasap option can be if you don’t need to access the filesystem again on this server. Otherwise, keeping the filesystem mounted can provide faster container startup time.
  1. List all available volumes
    # docker volume ls
  2. Remove volume driver
    # docker volume rm <volume id>
  3. List all containers
    # docker ps -a
  4. Remove a containers with container id
    # docker rm <container id>

Last updated by ObjectiveFS staff, July 9, 2020
ObjectiveFS is a shared file system for macOS and Linux that automatically scales and gives you scalable cloud storage. If you have questions or article idea suggestions, please email us at support@objectivefs.com