Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit d0291e9

Browse files
committed
Merge pull request #45 from cameronmaske/mount-options
Allow nfs mount options to be configurable through the CLI
2 parents 1cec03b + b1af7cf commit d0291e9

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ Usage: ./docker-machine-nfs.sh <machine-name> [options]
4444
Options:
4545
4646
-f, --force Force reconfiguration of nfs
47-
-n, --nfs-config NFS configuration to use in /etc/exports. (default to '-alldirs -mapall=$(id -u):$(id -g)')
47+
-n, --nfs-config NFS configuration to use in /etc/exports. (default to '-alldirs -mapall=\$(id -u):\$(id -g)')
4848
-s, --shared-folder,... Folder to share (default to /Users)
49+
-m, --mount-opts NFS mount options (default to 'noacl,async')
4950
5051
Examples:
5152
@@ -60,6 +61,11 @@ Examples:
6061
$ docker-machine-nfs test --shared-folder=/var/www --nfs-config="-alldirs -maproot=0"
6162
6263
> Configure the /var/www folder with NFS and the options '-alldirs -maproot=0'
64+
65+
$ docker-machine-nfs test --mount-opts="noacl,async,nolock,vers=3,udp,noatime,actimeo=1"
66+
67+
> Configure the /User folder with NFS and specific mount options.
68+
6369
```
6470
6571
## Credits

docker-machine-nfs.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Options:
5757
-f, --force Force reconfiguration of nfs
5858
-n, --nfs-config NFS configuration to use in /etc/exports. (default to '-alldirs -mapall=\$(id -u):\$(id -g)')
5959
-s, --shared-folder,... Folder to share (default to /Users)
60+
-m, --mount-opts NFS mount options (default to 'noacl,async')
6061
6162
Examples:
6263
@@ -72,6 +73,10 @@ Examples:
7273
7374
> Configure the /var/www folder with NFS and the options '-alldirs -maproot=0'
7475
76+
$ docker-machine-nfs test --mount-opts="noacl,async,nolock,vers=3,udp,noatime,actimeo=1"
77+
78+
> Configure the /User folder with NFS and specific mount options.
79+
7580
EOF
7681
exit 0
7782
}
@@ -124,6 +129,7 @@ setPropDefaults()
124129
prop_machine_name=
125130
prop_shared_folders=()
126131
prop_nfs_config="-alldirs -mapall="$(id -u):$(id -g)
132+
prop_mount_options="noacl,async"
127133
prop_force_configuration_nfs=false
128134
}
129135

@@ -154,6 +160,11 @@ parseCli()
154160
prop_nfs_config="${i#*=}"
155161
;;
156162

163+
-m=*|--mount-opts=*)
164+
prop_mount_options="${i#*=}"
165+
;;
166+
167+
157168
-f|--force)
158169
prop_force_configuration_nfs=true
159170
shift
@@ -181,6 +192,8 @@ parseCli()
181192
do
182193
echoProperties "Shared Folder: $shared_folder"
183194
done
195+
196+
echoProperties "Mount Options: $prop_mount_options"
184197
echoProperties "Force: $prop_force_configuration_nfs"
185198

186199
echo #EMPTY
@@ -360,7 +373,7 @@ configureBoot2Docker()
360373
for shared_folder in "${prop_shared_folders[@]}"
361374
do
362375
bootlocalsh="${bootlocalsh}
363-
sudo mount -t nfs -o noacl,async "$prop_nfshost_ip":"$shared_folder" "$shared_folder
376+
sudo mount -t nfs -o "$prop_mount_options" "$prop_nfshost_ip":"$shared_folder" "$shared_folder
364377
done
365378

366379
local file="/var/lib/boot2docker/bootlocal.sh"

0 commit comments

Comments
 (0)