fix #22529: disable nfsv4 and use nfsv3

This commit is contained in:
Huamin Chen 2016-03-07 15:22:10 +00:00
parent e93c0d727f
commit 3a914c2583
3 changed files with 21 additions and 10 deletions

View File

@ -17,9 +17,10 @@ MAINTAINER Jan Safranek, jsafrane@redhat.com
RUN yum -y install /usr/bin/ps nfs-utils && yum clean all
RUN mkdir -p /exports
ADD run_nfs.sh /usr/local/bin/
ADD index.html /exports/index.html
RUN chmod 644 /exports/index.html
ADD index.html /tmp/index.html
RUN chmod 644 /tmp/index.html
EXPOSE 2049/tcp
# expose mountd 20048/tcp and nfsd 2049/tcp
EXPOSE 2049/tcp 20048/tcp
ENTRYPOINT ["/usr/local/bin/run_nfs.sh", "/exports"]
ENTRYPOINT ["/usr/local/bin/run_nfs.sh", "/exports", "/"]

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
TAG = 0.5
TAG = 0.6
PREFIX = gcr.io/google_containers
all: push

View File

@ -21,19 +21,29 @@ function start()
for i in "$@"; do
# fsid=0: needed for NFSv4
echo "$i *(rw,fsid=0,insecure,no_root_squash)" >> /etc/exports
# move index.html to here
/bin/cp /tmp/index.html $i/
chmod 644 $i/index.html
echo "Serving $i"
done
# start rpcbind if it is not started yet
/usr/sbin/rpcinfo 127.0.0.1 > /dev/null; s=$?
if [ $s -ne 0 ]; then
echo "Starting rpcbind"
/usr/sbin/rpcbind -w
fi
mount -t nfsd nfds /proc/fs/nfsd
# -N 2 -N 3: disable NFSv2+3
# -V 4.x: enable NFSv4
/usr/sbin/rpc.mountd -N 2 -N 3 -V 4 -V 4.1
# -N 4.x: disable NFSv4
# -V 3: enable NFSv3
/usr/sbin/rpc.mountd -N 2 -V 3 -N 4 -N 4.1
/usr/sbin/exportfs -r
# -G 10 to reduce grace time to 10 seconds (the lowest allowed)
/usr/sbin/rpc.nfsd -G 10 -N 2 -N 3 -V 4 -V 4.1 2
/usr/sbin/rpc.nfsd -G 10 -N 2 -V 3 -N 4 -N 4.1 2
/usr/sbin/rpc.statd --no-notify
echo "NFS started"
}