Git Product home page Git Product logo

docker-nfs-client's Introduction

docker-nfs-client

Docker image for a light NFS client (~10.9MB). By default NFS 4 is used.

Based on https://github.com/evq/nfs-client.

Usage

Build

$ docker build -t nfs-client .

Run

Basic example, mounting NFS within container:

$ docker run -it --privileged=true --net=host -v /mnt/nfs-1 -e SERVER=192.168.0.9 -e SHARE=movies nfs-client

Writing back to the host:

$ docker run -itd \
    --privileged=true \
    --net=host \
    --name nfs-movies \
    -v /media/nfs-movies:/mnt/nfs-1:shared \
    -e SERVER=192.168.0.9 \
    -e SHARE=movies \
      nfs-client

Take note of the historic 'NFS shares and volumes don't mix' (#4213) to use shared or rshared as needed when needing to use --volumes-from with other containers. Additionally, after the container is killed you'll need to unmount the host mount too.

Runtime Environment Variables

There should be a reasonable amount of flexibility using the available variables. If not please raise an issue so your use case can be covered!

  • SERVER - the hostname of the NFS server to connect to
  • SHARE - the name of the NFS share to mount
  • MOUNT_OPTIONS - mount options to mount the NFS share with
  • FSTYPE - the filesystem type; specify nfs3 for NFSv3, default is nfs i.e. NFSv4
  • MOUNTPOINT - the mount point for the NFS share within the container

Tag and Push

$ docker tag -f nfs-client flaccid/nfs-client
$ docker push flaccid/nfs-client

License and Authors

The MIT License (MIT)

Copyright (c) 2015 Evey Quirk
Copyright (c) 2015 Chris Fordham

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

docker-nfs-client's People

Contributors

flaccid avatar imikushin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-nfs-client's Issues

/usr/local/bin/entry.sh: line 5: [IP_ADDRESS: not found

Using this example:

docker run -itd --privileged=true --name nfs --net=host -v /mnt/shared_nfs:/mnt/nfs-1:shared -e SERVER=nfs_server_ip -e SHARE=shared_path d3fk/nfs-client

I get this result (it still works tho):

/usr/local/bin/entry.sh: line 5: [IP_ADDRESS: not found
/local_path on /mnt/nfs-1 type ext4 (rw,relatime,errors=remount-ro)
IP_ADDRESS:/remote_share on /mnt/nfs-1 type nfs (rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=IP_ADDRESS,mountvers=3,mountproto=tcp,local_lock=none,addr=IP_ADDRESS)

Permission denied despite privileged tag

Hello, I am using an Ubuntu 18.04 as my NFS server in which I have created a local filesystem under /mnt/myfs with a dummy doc.txt which I would like to share with the NFS Client. The client afaik could be the docker container, so I am using the first suggestion on README of docker run using simply -it. I want to check if doc.txt was successfully shared.
I am connected via ethernet cable and provided the SERVER and SHARE having set the enp1s1 inet4 given by ifconfig and /mnt/mynfs respectively.
Nevertheless, I am getting an error when running:
mount: mounting to SERVER:/mnt/mynfs on /mnt/nfs-1 failed: Permission denied

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.