Dockerfiles in the CICS Docker Demonstration

This topic describes in detail the commands used by the Dockerfile in the CICS Docker demonstration. The Dockerfile is listed in its entirety and a following table describes the various Dockerfile commands. The line numbers in the listings of the Dockerfile have been added to aid readability. They are not present in the supplied Dockerfile.

Note: The Dockerfiles supplied for Red Hat Linux and SUSE Linux differ slightly. The Dockerfile shown below is the one supplied with Red Hat Linux. Where there are differences between the two versions they are described in the following table.
001  # Copyright (C) Micro Focus 2019. All rights reserved. 
002  # This sample code is supplied for demonstration purposes only
003  # on an "as is" basis and is for use at your own risk. 
004  
005  FROM microfocus/entserver:rhel7_5.0_x64
006  
007  ARG ESADM_USER=esadm
008  
009  LABEL com.microfocus.is-base-image="false"
010  
011  # Create user app and setup cobsetenv
012  USER root
013  
014  RUN useradd -ms /bin/bash app && \
015      usermod -aG $ESADM_USER app && \
016      touch /etc/profile && \
017      touch ~app/.bashrc && \
018      echo ". ~/bin/cobsetenv_login" >>~app/.bashrc && \
019      echo ". ~/bin/cobsetenv_login" >>~app/.bash_login
020  
021  COPY sample_setup /home/app/bin/
022  RUN  chown -R app /home/app
023  
024  USER app
025  ENV BASE /home/app/MSS
026  ENV CCITCP2_PORT 4790
027  WORKDIR "/home/app"
028  COPY MSS.tar.gz /home/app
029  COPY MSS64_export.tar.gz /home/app
030  RUN tar xvfp MSS.tar.gz && \
031      tar xvfp MSS64_export.tar.gz
032  
033  COPY cobsetenv_login /home/app/bin/
034  
035  EXPOSE 443 500-55000
036  
037  CMD /home/app/bin/sample_setup

The commands on the lines in this Dockerfile are as follows:

Lines Description
005 Specifies the base image to use, which is the Enterprise Server base image.

On SUSE Linux the tag specified in the Dockerfile is sles12sp3_5.0_x64.

007 Define build arguments passed by the docker build command:
  • ESADM_USER. Specifies the ID to be used for the Enterprise Server admin user.
009 Specify the metadata labels for the image that will be created. These labels can be queried using the docker inspect command.
012 Sets the user to root.
014 - 022 Run a series of concatenated commands to add the Enterprise Server admin user and set up the shell to be used by that user.
024 Sets the user name to be used when running the image.
025 - 026 Create environment variables to be used in this Dockerfile:
  • BASE. Specifies the base folder of the CICS application. This is required because this environment variable is used by the resource definitions specified in MSS*_export.zip.
  • CCITCP2_PORT. Specifies the port on which the CCITCP2 registration program operates. See Enterprise Server Communications Environment Variables for more information.
027 Sets the Docker working directory to be the folder where the CICS application source files are located.
028 - 031 Copy the .tar files containing the CICS application source files then extract the source files from them.
033 Copy the default environment that is to be used when someone logs on .
035 Specifies the network ports that the container will listen on at run-time.
037 Runs a script to start the Micro Focus Directory Server (MFDS), deploy the region definitions, then application and display the console .log file for the region until the container is terminated.