Building Your Own Container

Describes how to build a container using the Container Storage Interface (CSI) Storage Plugin template.

The Container Storage Interface (CSI) Storage Plugin includes a template in the build directory to build your own container. The following template shows the Container Storage Interface (CSI) Storage Plugin build for FUSE POSIX with CentOS 8 image. In the example, <tag> is the image version (available tags):
## FOR FUSE
# Copyright (c) 2009 & onwards. MapR Tech, Inc., All rights reserved
# CentOS Package Build
FROM centos:centos8
LABEL mapr.os=centos8
ENV container docker
# Setup repos and dl prereqs + Mapr Core
COPY mapr.repo /etc/yum.repos.d/
RUN rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8; \
   rpm --import https://<EMAIL>:<TOKEN>@package.ezmeral.hpe.com/releases/pub/maprgpg.key; \
   rpm --import https://<EMAIL>:<TOKEN>@package.ezmeral.hpe.com/releases/pub/gnugpg.key; \{noformat}
   yum -y update && yum -y clean all; \
   yum -y install epel-release; \
   sed -i 's/^mirror/#mirror/g' /etc/yum.repos.d/epel.repo; \
   yum install -y mapr-client mapr-posix-client-basic mapr-posix-client-platinum && \
   yum -y update && yum clean all && rm -rf /var/cache/yum; \
   mkdir -p /opt/mapr/lib/fusebasic /opt/mapr/lib/fuseplatinum; \
   cp /opt/mapr/lib/libMapRClient_c.so.1 /opt/mapr/lib/fusebasic/libMapRClient_c.so.0; \
   rm -rf /opt/mapr/lib/libMapRClient_c.so.1
# Add Tini
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
# Copy utils, driver and set entrypoint
COPY --from=docker.io/maprtech/csi-kdfdriver:<tag> \
    /go/src/plugin/bin/* /opt/mapr/bin/
RUN chmod +x /opt/mapr/bin/csi-kdfplugin; \
   chmod +x /opt/mapr/bin/start-fuse;
WORKDIR /opt/mapr
ENTRYPOINT ["/tini", "--", "bin/csi-kdfplugin"]

The template contains the information on the image for setting up the repository, deploying the (Basic, Container, or Platinum) POSIX client, information on the entry point, and Tini for POSIX process management. You can customize the template and build it by running the docker-custom-build.sh utility in the build directory or by running the docker build command with the custom image tag.

The following template shows the Container Storage Interface (CSI) Storage Plugin build for Loopsback NFS with CentOS 8 image. In the example, <tag> is the image version (available tags):
## FOR NFS
 
# Copyright (c) 2009 & onwards. MapR Tech, Inc., All rights reserved

# CentOS Package Build
FROM centos:centos8
LABEL mapr.os=centos8
ENV container docker
# Setup repos and dl prereqs + Mapr Core
COPY mapr.repo /etc/yum.repos.d/
RUN rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8; \
    rpm --import https://<EMAIL>:<PASSWORD>@package.ezmeral.hpe.com/releases/pub/maprgpg.key; \
    rpm --import https://<TOKEN>:<PASSWORD>@package.ezmeral.hpe.com/releases/pub/gnugpg.key; \{noformat}
    rpm --import https://package.ezmeral.hpe.com/releases/pub/maprgpg.key; \
    rpm --import https://package.ezmeral.hpe.com/releases/pub/gnugpg.key; \
    yum -y update && yum -y clean all; \
    yum -y install epel-release; \
    sed -i 's/^mirror/#mirror/g' /etc/yum.repos.d/epel.repo; \
    sed -i 's/^#base/base/g' /etc/yum.repos.d/epel.repo; \
    yum install -y mapr-loopbacknfs; \
    yum clean all && rm -rf /var/cache/yum
  
# Add Tini
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
 
# Copy utils, driver and set entrypoint
COPY --from=docker.io/maprtech/csi-nfsdriver:<tag> \
     /go/src/plugin/bin/* /opt/mapr/bin/
RUN chmod +x /opt/mapr/bin/csi-nfsplugin; \
    chmod +x /opt/mapr/bin/start-loopbacknfs;
WORKDIR /opt/mapr
ENTRYPOINT ["/tini", "--", "bin/csi-nfsplugin"]