d3fk/nfs-client
A small docker NFS client. Perfect for enabling whatever to NFS, compatible with databases.
1M+
This is a Docker multi-arch image for a light NFS client () compatible with database usage.
We provide 2 tags for this image
pre-build as multi-arch from Docker hub with "automated build" option.
image name d3fk/nfs-client
docker pull d3fk/nfs-client
Docker hub repository: https://hub.docker.com/r/d3fk/nfs-client/
Based on https://github.com/flaccid/docker-nfs-client
The image is now built from the original Alpine with automated build. Default NFS type modified to NFS3 for local IT requirements. The entry script was adapted to be compatible with using this NFS client with database (mariadb, mysql...) and to permit running the container without setting the SERVER and SHARE env parameters, simply to share on the host's network the NFS client capabilities for mounting any NFS shared path on the host (quite useful with small os)
The container is now made available as multi-arch image, build from Docker Hub nodes dedicated to automated builds. This multi-arch image will fit most of architectures:
As this container is quite widely used , we'll remain with NFS3 as default FSTYPE on the historical tag "latest" to avoid to create any anoying breaking issue, but the ENVIRONMENT variables enable you to change easily to NFS 4 or any other filesystem types supported: The filesystem types which are currently supported include adfs, affs, autofs, cifs, coda, coherent, cramfs, debugfs, devpts, efs, ext, ext2, ext3, ext4, hfs, hfsplus, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4, ramfs, reiserfs, romfs, squashfs, smbfs, sysv, tmpfs, ubifs, udf, ufs, umsdos, usbfs, vfat, xenix, xfs, xiafs.
A new image tag was created "v4" for the users who needed a ready to go nfs4 client without setting additional ENVIRONMENT variables.
SERVER
- the hostname or IP of the NFS server to connect toSHARE
- the NFS shared path to mountMOUNT_OPTIONS
- mount options to mount the NFS share with; the default is nfsvers=3
on d3fk/nfs-client:latest and nfsvers=4
on d3fk/nfs-client:v4FSTYPE
- the filesystem type; default is nfs
in d3fk/nfs-client:latest for NFS3 mount, and default is nfs4
in d3fk/nfs-client:v4MOUNTPOINT
- the mount point for the NFS share within the container (default is /mnt/nfs-1)Several possibilities:
Run the container
docker run -itd --privileged=true --net=host d3fk/nfs-client
then you can use NFS to mount all your mountpoints on your host
sudo mount -t nfs SERVER_IP:/shared_path /mount_point
Basic command
docker run -itd --privileged=true --net=host -e SERVER=nfs_server_ip -e SHARE=shared_path d3fk/nfs-client
It is more convenient to set a volume
Simply add a volume if you need to share the volume with other containers or mount it directly on your host (take care to add the :shared mention on the volume option)
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
Then, using the --volume-from nfs
option when runing another container will also made available the nfs shared content in this new container
Alternatively if you are not using a "named volume" but a "shared volume" you could also directly mount the host's directory that mounts the nfs in the new container
by adding the nfs service to one of your cloud-config.yml, user-config.yml or enabled service.yml...
i.e: see the file rancheros-cloud-config.yml
You could also use the additional mount syntax addapted to NFS (since you now have a nfs-client started at os startup). ie:
#cloud-config
mounts:
- ["SERVER_IP:/shared_path", "/mnt/nfs-1", "nfs", ""]
The MIT License (MIT)
Copyright (c) 2015 Evey Quirk
Copyright (c) 2015 Chris Fordham
Copyright (c) 2016 d3fk
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 pull d3fk/nfs-client