GithubHelp home page GithubHelp logo

nfsvol's Introduction

nfsvol ๐Ÿ“‚

Docker Volume Plugin for managing NFS storage

Quickstart

The plugin assumes there's a directory in the host named /mnt/nfs which is where you have NFS mounted to. This doesn't mean that you really need to have that as a NFS mount point. The plugin will put files there; not having NFS will only mean that it won't be distributed across hosts.

(are you a docker-for-mac user? Issue docker run --rm --privileged --pid=host justincormack/nsenter1 /bin/sh -c 'mkdir -p /mnt/nfs' to create /mnt/nfs inside the docker-for-mac VM. For more about the command, see #Tips section).

Having that, install the plugin:

docker plugin install \
        --grant-all-permissions \
        --alias nfsvol \
        cirocosta/nfsvol

If nothing went bad (Docker would complain) you can create named volumes and use them:

docker volume create \
        --driver nfsvol \
        myvolume1

docker run \
        -it \
        -v myvolume2:/somewhere \
        alpine \
        echo 'heyhey' > /somewhere/file2.txt

docker run \
        -it \
        -v myvolume3:/somewhere \
        alpine \
        echo 'heyhey' > /somewhere/file1.txt

The effect of this is having the data under a well defined structure under your NFS mount:

/mnt
  /nfs
    /myvolume1
    /myvolume2
      /file2.txt
    /myvolume3
      /file3.txt

Tips (Docker-for-{mac,aws})

You can check whether you have a NFS mount active by using the mount command on Linux. For instance, using AWS EFS as the NFS mount point:

mount

/dev/xvdb1 on / type ext4 (rw,relatime,data=ordered)
/dev/xvdb1 on /mnt type ext4 (rw,relatime,data=ordered)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,mode=755)

...

# what we want:
<fs-id>.efs.us-west-2.amazonaws.com:/ on /mnt/nfs type nfs4 (rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=<address>,local_lock=none,addr=<address>)

In case you're running docker-for-mac or docker-for-aws you don't have direct access to the host out of the box. For both cases you can use justincormack/nsenter1 alongside --pid argument to enter the namespaces used for the pid 1 of the machine, giving you access to the filesystem:

docker run \
        --rm \
        -it \
        --privileged \
        --pid=host \
        justincormack/nsenter1 \
        /bin/sh

Having done that, just mkdir -p /mnt/nfs.

Mounting Inside or Outside?

This plugin assumes that a NFS moint-point exists in the host. The rationale for keeping it outside the plugin container is that this way we can keep the NFS statistics going through node_exporter.

In the TODO list we could extend this plugin to support mounting NFS at start up time and make more sense to have nfs in the name ๐Ÿ™Œ

Build Status

nfsvol's People

Contributors

beldpro-ci avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nfsvol's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.