Created
August 4, 2017 07:24
-
-
Save moriyoshi/c4d4ae546ff0c0d6de2f16ec03b2ad11 to your computer and use it in GitHub Desktop.
NFS test server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.6 | |
RUN apk update && apk add nfs-utils openrc rsyslog | |
EXPOSE 2049 2050 2051 2052 | |
VOLUME /export | |
RUN (\ | |
echo '$ModLoad omstdout.so'; \ | |
echo '$ModLoad imuxsock.so'; \ | |
echo '$ModLoad imklog.so'; \ | |
echo '*.* :omstdout:'; \ | |
) > /etc/rsyslog.conf | |
RUN echo '/export *(rw,insecure,all_squash)' > /etc/exports | |
RUN (echo 'OPTS_RPC_MOUNTD="-p 2050"'; echo 'OPTS_RPC_STATD="-p 2051 -o 2052"') > /etc/conf.d/nfs | |
# https://github.com/neeravkumar/dockerfiles/blob/master/alpine-openrc/Dockerfile | |
# Tell openrc its running inside a container, till now that has meant LXC | |
RUN sed -i 's/#rc_sys=""/rc_sys="lxc"/g' /etc/rc.conf && \ | |
# Tell openrc loopback and net are already there, since docker handles the networking | |
echo 'rc_provide="loopback net"' >> /etc/rc.conf && \ | |
# no need for loggers | |
sed -i 's/^#\(rc_logger="YES"\)$/\1/' /etc/rc.conf && \ | |
# can't get ttys unless you run the container in privileged mode | |
sed -i '/tty/d' /etc/inittab && \ | |
# can't set hostname since docker sets it | |
sed -i 's/hostname $opts/# hostname $opts/g' /etc/init.d/hostname && \ | |
# can't mount tmpfs since not privileged | |
sed -i 's/mount -t tmpfs/# mount -t tmpfs/g' /lib/rc/sh/init.sh && \ | |
# can't do cgroups | |
sed -i 's/cgroup_add_service /# cgroup_add_service /g' /lib/rc/sh/openrc-run.sh | |
RUN rc-update add nfs | |
CMD ["/bin/sh", "-c", "/usr/sbin/rsyslogd -n -f /etc/rsyslog.conf & /sbin/openrc sysinit; wait"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment