Add nfs-ganesha to docker container

The change adds nfs-ganesha to the container image. Nfs-ganesha
is compiled with dbus support on. Also some initial container
setup is performed.

Change-Id: Ic0b350ce5aa2efd16dc71e46dcd3c6159ca17978
This commit is contained in:
Alexey Ovchinnikov 2016-06-16 10:57:04 +03:00
parent 5db8e619c1
commit f8b4f63cbb
6 changed files with 115 additions and 14 deletions

View File

@ -1,20 +1,94 @@
FROM phusion/baseimage:0.9.18
EXPOSE 445
EXPOSE 139
EXPOSE 135
EXPOSE 111 2049 60934 43440 55392 53559 875
CMD ["/sbin/my_init"]
RUN apt-get update && apt-get install -y samba smbclient
# The enormous RUN block is needed to reduce resulting container size
# as it prevents docker from snapshotting container before all unneeded
# packages are removed. It is made by combining several separate steps:
# setting up necessary packages, compiling and setting up ganesha,
# setting up samba and removing unneeded packages.
RUN apt-get update && apt-get install -y \
bison \
build-essential \
cmake \
dbus \
doxygen \
flex \
git-core \
libcephfs-dev \
libdbus-1-dev \
libgssglue-dev \
libkrb5-dev \
libtirpc1 \
libssl-dev \
nfs-common \
pkg-config \
portmap \
python-dbus \
samba \
smbclient \
uuid-dev &&\
mkdir -p /shares &&\
chmod 0777 /shares &&\
mkdir -pv /var/run/dbus &&\
cd /usr/src &&\
git clone https://github.com/nfs-ganesha/nfs-ganesha.git &&\
cd nfs-ganesha &&\
git checkout -b V2.3-stable origin/V2.3-stable &&\
git submodule update --init &&\
mkdir -p build &&\
cd build &&\
cmake -DUSE_DBUS=ON -DUSE_FSAL_LUSTRE=OFF ../src &&\
make &&\
make install &&\
make clean &&\
cp /usr/src/nfs-ganesha/src/scripts/ganeshactl/org.ganesha.nfsd.conf \
/etc/dbus-1/system.d &&\
rm -rf /usr/src/nfs-ganesha &&\
adduser --disabled-password --gecos '' master &&\
(echo pwd; echo pwd) | smbpasswd -a -s master &&\
sed -i "/\[global\]/a\ \ \ include = registry" /etc/samba/smb.conf &&\
apt-get clean &&\
mkdir -p /etc/ganesha &&\
mkdir -p /etc/service/rpcbind &&\
mkdir -p /etc/service/ganesha &&\
mkdir -p /etc/service/samba &&\
mkdir -p /etc/service/dbus &&\
apt-get purge -y \
bison \
build-essential \
cmake \
cmake-data \
comerr-dev \
cpp \
cpp-4.8 \
doxygen \
dpkg-dev \
flex \
g++ \
g++-4.8 \
gcc \
gcc-4.8 \
git \
git-core \
git-man \
libc6-dev \
libcephfs-dev \
libfl-dev \
libgcc-4.8-dev \
libkrb5-dev \
libstdc++-4.8-dev \
linux-libc-dev \
make \
manpages \
manpages-dev \
uuid-dev &&\
apt-get autoremove -y
RUN mkdir /shares
RUN chmod 0777 /shares
RUN adduser --disabled-password --gecos '' master
RUN (echo pwd; echo pwd) | smbpasswd -a -s master
RUN sed -i "/\[global\]/a\ \ \ include = registry" /etc/samba/smb.conf
RUN apt-get clean
entrypoint ["/usr/sbin/smbd"]
cmd ["-F", "-S"]
ADD dbus.sh /etc/service/dbus/run
ADD rpcbind.sh /etc/service/rpcbind/run
ADD ganesha.sh /etc/service/ganesha/run
ADD ganesha.conf /etc/ganesha/ganesha.conf
ADD samba.sh /etc/service/samba/run

2
data/docker/dbus.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
/bin/dbus-daemon --nofork --system

17
data/docker/ganesha.conf Normal file
View File

@ -0,0 +1,17 @@
EXPORT
{
Export_ID = 0;
Path = "/shares";
Pseudo = "/shares";
Squash = No_Root_Squash;
Transport_Protocols = TCP;
Disable_ACL = True;
SecType = "none";
CLIENT {
Clients = *;
Access_Type = RO;
}
FSAL {
Name = VFS;
}
}

2
data/docker/ganesha.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
ganesha.nfsd -L /var/log/ganesha.log -F

4
data/docker/rpcbind.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /
echo Starting rpcbind...
/sbin/rpcbind -d

2
data/docker/samba.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
/usr/sbin/smbd -F -S