Question
· Mar 19, 2019

Cache docker image

Hello all,

I am having some issues creating a docker image with a fresh cache installation. The error that I am getting right now is that gzip is required for a cache installation, but was not found in my system. Even though, this is shown as installed in the base centos 7 image. My host machine is Windows 10 using the latest docker version.

Here is my dockerfile, its simple:

FROM centos:latest

RUN yum update -y && yum -y upgrade

COPY ./cache-2017.1.3.317.0.18571-lnxrhx64.tar.gz .

RUN tar -zxf cache-2017.1.3.317.0.18571-lnxrhx64.tar.gz

RUN ISC_PACKAGE_INSTANCENAME="MyDatabase" \

          ISC_PACKAGE_INSTALLDIR="/usr/cachesys/" \

          ISC_PACKAGE_UNICODE="Y" \

         ISC_PACKAGE_CLIENT_COMPONENTS="" \

         ISC_PACKAGE_INITIAL_SECURITY="Minimal" \

        /cache-2017.1.3.317.0.18571-lnxrhx64/cinstall_silent



EXPOSE 57772 22 1972

ENTRYPOINT ["ccontrol", "start cache"]

 

Any direction or help would be greatly appreciated. This is not for production, but for development purposes and testing.

Discussion (9)1
Log in or sign up to continue

Look at this my article where you will find some details, how to build Cache in docker on centos.

Instead of COPY and tar I would recommend using ADD command because it doing extract at the same time.

And for doing such build, you should have file cache-2017.1.3.317.0.18571-lnxrhx64.tar.gz close to the Dockerfile, or in the root of build context.

If you do build this way. Cache distributive should be in the current folder.

docker build .

But, you will face an issue with Storage Driver. It will look like, successful build but PROTECT error during startup. With previous versions of Docker it was possible to change Storage driver to aufs, but not with the latest version, where support for such driver already removed. There are some tricks on how to manage to work with it, but I would not recommend it.

Nowadays only IRIS 2019.1 works quite well in Docker with the default storage driver out of the box.

I would argue about using VM instead of Docker. My choice is Docker for sure, for many reasons. It is not so difficult to make it worked in Docker, and you will get a lot from it. And if it is possible for you to move to IRIS, it would be a good way to go.

I've been working for many different projects at the same time, and use Docker for all of them.

Unless I misunderstood something, you said there is no storage driver for windows that can work with cache in a docker image. What are the issues with it, and how to get around it? Still trying to figure out the gzip issue I am having (first time ever getting something like this when gzip is already in the image).

I would love to use Docker. Thanks for your time.

John,

I thought I would add another example to this as  I have never needed to use the control wrapper solution.  I found I had to add gzip as an installed package in my docker file.  Below is a docker image built for centos.  The installation is HealthShare rather than Cache, but the that is just a change in the InterSystems installer referenced.   The overall process should work with value that make sense for your environment.  One  very important change is that the entry point should be ccontainermain.  The reason for this is the entry point needs to stay running to keep the container up and running.  Ccontrol will start Cache then end which will actually exit and shutdown the container.  There is a link to where to find this program at https://community.intersystems.com/post/cache-db-docker-container

# pull from this repository
# note that if you don't have the distribution you're after it will be automatically
# downloaded from Docker central hub repository (you'll have to create a user there)
#
FROM centos:latest

# setup vars section___________________________________________________________________
#
ENV TMP_INSTALL_DIR=/tmp/distrib

# vars for Caché silent install
ENV ISC_PACKAGE_INSTANCENAME="HSPI" \
    ISC_PACKAGE_INSTALLDIR="/opt/intersystems/healthshare" \
    ISC_PACKAGE_INITIAL_SECURITY="Normal" \
    ISC_PACKAGE_CLIENT_COMPONENTS=""  \
    ISC_PACKAGE_USER_PASSWORD="xxxx" \
    ISC_PACKAGE_CSPSYSTEM_PASSWORD="xxxx" \
    ISC_PACKAGE_HSMODULES="coretech,hscore,mprl,hspi"

# distribution file________________________________________________________________
# set-up and install from distrib_tmp dir
RUN mkdir ${TMP_INSTALL_DIR} && \
    mkdir -p ${ISC_PACKAGE_INSTALLDIR}/mgr
WORKDIR ${TMP_INSTALL_DIR}

# update OS + dependencies & run silent install___________________________________
RUN yum -y update && \
    yum -y install tar gzip which java-1.8.0-openjdk

ADD HealthShare-2018.1-Exchange_Insight_Index-b7718-lnxrhx64.tar.gz .

RUN ./HealthShare-*/cinstall_silent && \
    rm -rf ${TMP_INSTALL_DIR}/* && \
    ccontrol stop $ISC_PACKAGE_INSTANCENAME quietly 
COPY cache.key $ISC_PACKAGE_INSTALLDIR/mgr/

# TCP sockets that can be accessed if user wants to (see 'docker run -p' flag)
EXPOSE 57772 1972

# container main process PID 1 (https://github.com/zrml/ccontainermain)
WORKDIR /
ADD ccontainermain .

ENTRYPOINT  ["/ccontainermain","-cconsole","-i", "HSPI"]

This answer is for others who are looking for a complete answer that worked for me. This is all thanks to Dmitry and Rich. I hope this helps someone else when they are searching the forums. My host machine is Windows 10 1809. My docker version is 2.0.0.3.

I had to use both ccontainermain and the ccontrol-wrapper.sh. My final dockerfile that is working successfully is:

FROM centos:latest

 

ENV TMP_INSTALL_DIR=/tmp/distrib

ENV ISC_PACKAGE_INSTANCENAME="CACHE"

ENV ISC_PACKAGE_INSTALLDIR="/usr/cachesys"

ENV ISC_PACKAGE_UNICODE="Y"

ENV ISC_PACKAGE_INITIAL_SECURITY="Minimal"

ENV ISC_PACKAGE_CLIENT_COMPONENTS=""

 

RUN mkdir ${TMP_INSTALL_DIR}

WORKDIR ${TMP_INSTALL_DIR}

 

RUN yum -y update && \

yum -y install tar gzip which java-1.8.0-openjdk

 

ADD cache-2017.1.3.317.0.18571-lnxrhx64.tar.gz .

RUN ./cache-2017.1.3.317.0.18571-lnxrhx64/cinstall_silent && rm -rf /tmp/distrib && ccontrol stop cache quietly

 

COPY ccontrol-wrapper.sh /usr/bin/

RUN cd /usr/bin && \

rm ccontrol && \

mv ccontrol-wrapper.sh ccontrol && \

chmod 555 ccontrol

 

WORKDIR /

ADD ccontainermain .

 

EXPOSE 57772 22 1972

 

ENTRYPOINT ["/ccontainermain", "-i", "CACHE"]