Building Your Own Container

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

FUSE POSIX Example with CentOS 8 Image

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 a 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.

Loopback NFS Example with CentOS 8 Image

The following template shows the Container Storage Interface (CSI) Storage Plugin build for Loopback NFS with CentOS 8 image. In the example, <tag> is the image version (see 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}
    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"]

Considerations for Using the Password Protected Repository

In the preceding examples, note that you must include your HPE Passport credentials to enable the rpm --import <URL> command to work. In addition, you must include the same credentials in your maprtech.repo file, as described in Adding the Data Fabric Repository on RHEL, CentOS, or Oracle Linux. For example:
[MapR_Core]
name = MapR Core Components
enabled = 1
baseurl = https://package.ezmeral.hpe.com/releases/v6.2.0/redhat/
username = <EMAIL>
password = <TOKEN>
protected = 1
gpgcheck = 1

[MapR_MEP]
name = MapR MEP Components
enabled = 1
baseurl = https://package.ezmeral.hpe.com/releases/MEP/MEP-7.1.0/redhat/
username = <EMAIL>
password = <TOKEN>
protected = 1
gpgcheck = 1
For more information about the new repository, see Using the HPE Ezmeral Token-Authenticated Internet Repository.