This topic describes in detail the commands used by the Dockerfile in the Docker demonstration for the COBOL Server base image. 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.
001 # Copyright (C) Micro Focus 2018. All rights reserved.
002
003 FROM rhel7/rhel:latest
004
005 # PRODUCT_VERSION is product version associated with this Dockerfile
006 # SETUP_EXE is the build-arg name for the name of installer
007 # ACCEPTEULA is the build-arg name for the acceptance of the end user license agreement
008 # MFLICFILE is the build-arg name for the license filename
009 ARG PRODUCT_VERSION=4.0.00
010 ARG SETUP_EXE=setup_cobol_server_for_docker_4.0_redhat_x64
011 ARG ACCEPTEULA
012 ARG LOGFILE=COBOLServer4.0.log
013 ARG MFLICFILE
014
015 ARG ESADM_UID=500
016 ARG ESADM_GID=500
017 ARG ESADM_USER=esadm
018 ARG ESADM_SHELL=/bin/bash
019
020 LABEL vendor="Micro Focus" \
021 com.microfocus.name="COBOL Server" \
022 com.microfocus.version="$PRODUCT_VERSION" \
023 com.microfocus.eula.url="https://supportline.microfocus.com/licensing/agreements.aspx" \
024 com.microfocus.is-base-image="true"
025
026 ENV MFPRODBASE=/opt/microfocus/VisualCOBOL
027 ENV MFLICBASE=/var/microfocuslicensing
028
029 # install ed and pax, as these are a pre-req for the installer
030 # note: disablerepo is used to avoid "HTTPS Error 403 - Forbidden" error
031 RUN yum --disablerepo=rhel-7-server-rt-beta-rpms -y install ed pax
032
033 # copy the installer from the local machine to the container
034 COPY ${SETUP_EXE} /tmp/${SETUP_EXE}
035
036 # Create user esadm
037 RUN groupadd -f -g $ESADM_GID $ESADM_USER && \
038 useradd -u $ESADM_UID -g $ESADM_GID -m -s $ESADM_SHELL $ESADM_USER
039
040 # ensure the setup exe has execute permissions and execute the setup
041 RUN chmod +x ./tmp/${SETUP_EXE} && \
042 (/tmp/$SETUP_EXE -${ACCEPTEULA} -ESadminID=$ESADM_USER || (echo ${LOGFILE} contains && touch ${LOGFILE} && cat ${LOGFILE} && exit 1)) && \
043 rm -f tmp/${SETUP_EXE} && \
044 echo "$MFPRODBASE/lib" >>/etc/ld.so.conf && \
045 ldconfig
046
047 # install a license and remove the license file
048 COPY ${MFLICFILE} /tmp/
049 RUN cd /tmp && $MFLICBASE/bin/MFLicenseAdmin -install "${MFLICFILE}" && rm -f "${MFLICFILE}"
050 #
051 # clean up for containers that use -network:host
052 #
053 RUN $MFLICBASE/bin/clean_guid_file The commands on the lines in this Dockerfile are as follows:
| Lines | Description |
|---|---|
| 003 | Specifies the base image to use. For Red Hat this is the official Docker image for Red Hat Enterprise Linux.
For SUSE Linux this line is as follows: FROM suse/sles12sp3 This specifies that the base image to use is the official Docker image for SUSE Linux Enterprise Server. |
| 009 - 018 | Define build arguments passed by the
docker build command:
|
| 020 - 024 | Specify the metadata labels for the image that will be created. These labels can be queried using the docker inspect command. |
| 026 - 027 | Create environment variables to be used in this Dockerfile:
|
| 031 | Install software that is required to be able to install
COBOL Server.
The Dockerfile for SUSE Linux uses two separate commands for this whereas the Dockerfile for Red Hat Linux only uses one. |
| 034 | Copy the installation file for COBOL Server into a temporary folder. |
| 037 - 038 | Run a series of concatenated commands to add the Enterprise Server admin user and set up the shell to be used by that user. |
| 041 - 045 | Run a series of concatenated commands to perform the following actions:
|
| 048 - 049 | Copy the license file to a temporary location, use it to license COBOL Server, then delete the license file. |
| 053 | Run a script to reset the temporary file used when applying the license for COBOL Server. |