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.
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
An ObjectiveFS filesystem has been created (see get started).
# /usr/lib/docker/objectivefs-docker-volume
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>
Mount the ofsvol1
volume on dir
inside the container.
# docker run -it -v ofsvol1:<dir> busybox /bin/sh
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>
Mount the ofsvol2
volume on dir
inside the container.
# docker run -it -v ofsvol2:<dir> busybox /bin/sh
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
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>
Mount the ofsvol3
volume on dir
inside the container.
# docker run -it -v ofsvol3:<dir> busybox /bin/sh
Usage:
# docker volume create \
--driver=objectivefs <docker vol id> \
-ofs=<filesystem name> \
[-o<OBJECTIVEFS_ENV_VAR>=<value>] \
[-ooptions=<mount options>] \
[-oasap]
-o<OBJECTIVEFS_ENV_VAR>=<value>
./etc/objectivefs.env/
.mt
, noatime
can be set in the mount options field.-ooptions=mt,noatime
.-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.-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.# docker volume ls
# docker volume rm <volume id>
# docker ps -a
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