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.

Before reading this topic you should be familiar with the processes defined in Building a Base Image Containing Enterprise Test Server and Building an Image Containing an Application to Run Under Enterprise Server, and you need to have run the Docker demonstration to have created a base image for Enterprise Server.

001  # Copyright (C) Micro Focus 2018. 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  ARG ESTAG
006  FROM microfocus/enttstserver:${ESTAG}
007  
008  LABEL com.microfocus.is-example="true"
009  
010  # required arguments
011  ARG ETSPLATFORM
012  
013  # optional arguments
014  ARG APPDIR=c:\\app
015  
016  # copy the application to the application directory
017  ENV BASE "${APPDIR}\\MSS"
018  COPY MSS${ETSPLATFORM}_export.zip "${APPDIR}\\MSS_export.zip"
019  COPY MSS.zip "${APPDIR}\\"
020  
021  # set the start directory and the initial program name
022  WORKDIR "${APPDIR}"
023  
024  RUN set APPDIR=${APPDIR} && \
025      powershell -Command "Expand-Archive MSS.zip -DestinationPath %APPDIR%\MSS" && \
026      powershell -Command "Expand-Archive MSS_export.zip -DestinationPath %APPDIR%" && \
027      del MSS.zip && \
028      del MSS_export.zip
029  
030  WORKDIR "${APPDIR}\MSS${ETSPLATFORM}"
031  
032  ENV ETSPLATFORM=${ETSPLATFORM}
033  
034  CMD powershell -file ..\MSS\DeployAndWait.ps1
035  
036  EXPOSE 86 443 500-55000

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

Lines Description
005 - 006 Specifies the base image to use, which is the Enterprise Server base image.
008 Specify the metadata labels for the image that will be created. These labels can be queried using the docker inspect command.
011 - 014 Define build arguments passed by the docker build command:
  • ETSPLATFORM.

    Either x86 or x64 indicating whether the CICS application will be running in a 32-bit or 64-bit environment respectively.

  • APPDIR. Specifies the folder in the image's filesystem that the CICS application is copied into. c:\app is used if this argument is not specified.
017 - 019 Copy the .zip files containing the CICS application source files to the relevant folders in the image's filesystem.
022 Sets the Docker working directory to be the directory containing the CICS application.
024 - 028 Runs a series of concatenated Windows commands to unzip the CICS application source files to the relevant folders in the image's filesystem then delete the .zip files.
030 Sets the Docker working directory to be the platform-specific folder into which you unzipped the CICS application source files.
032 Creates an environment variable to hold a value that indicates whether the CICS application will be running in a 32-bit or 64-bit environment.
034 Runs a PowerShell 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.
036 Specifies the network ports that the container will listen on at run-time.