forked from outstand/docker-nfs-client
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
49 lines (42 loc) · 1.79 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM alpine:3.17.3
MAINTAINER Ryan Schlesinger <[email protected]>
# USAGE
# $ docker build -t nfs-client .
# $ docker run -it --privileged=true --net=host -v /mnt/nfs-1 -e SERVER=192.168.0.9 -e SHARE=movies nfs-client
# or detached:
# $ docker run -itd --privileged=true --net=host -v /mnt/nfs-1 -e SERVER=192.168.0.9 -e SHARE=movies nfs-client
# or with some more options:
# $ docker run -itd \
# --name nfs-vols \
# --restart=always \
# --privileged=true \
# --net=host \
# -v /:/mnt/host \
# -e SERVER=192.168.0.9 \
# -e SHARE=movies \
# -e MOUNT_OPTIONS="nfsvers=3,ro" \
# -e FSTYPE=nfs \
# -e MOUNTPOINT=/mnt/host \
# nfs-client
ENV DUMB_INIT_VERSION 1.2.0
RUN apk add --no-cache curl ca-certificates && \
mkdir -p /tmp/build && \
cd /tmp/build && \
curl -O -L https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64 && \
curl -O -L https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/sha256sums && \
grep dumb-init_${DUMB_INIT_VERSION}_amd64$ sha256sums | sha256sum -c && \
chmod +x dumb-init_${DUMB_INIT_VERSION}_amd64 && \
cp dumb-init_${DUMB_INIT_VERSION}_amd64 /bin/dumb-init && \
ln -s /bin/dumb-init /usr/bin/dumb-init && \
cd /tmp && \
rm -rf /tmp/build && \
apk del curl
ENV FSTYPE nfs4
ENV MOUNT_OPTIONS nfsvers=4
ENV MOUNTPOINT /mnt/nfs-1
RUN apk add --no-cache --update nfs-utils && \
rm /sbin/halt /sbin/poweroff /sbin/reboot
HEALTHCHECK --interval=1s --timeout=5s --start-period=60s \
CMD mount -t nfs | grep "$SERVER:$SHARE" || exit 1
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]