This topic outlines the steps that a Dockerfile must carry out to create an image that contains a COBOL application that can
be run under
Enterprise Developer Build Tools for Windows.
The process defined in this topic is used by the supplied container demonstrations that create images for applications that
you can use with
Enterprise Developer Build Tools for Windows. When you need to create an image to contain an application of yours,
Micro Focus recommends that you base your Dockerfile on a container demonstration's Dockerfile (rather that write your Dockerfile from
scratch) because that Dockerfile already performs the steps described in this topic. For more information on one of those
container demonstrations, including information on all the files it contains, see
The
CICS Container Demonstration.
Note: A separate document,
Best Practices for Moving Your COBOL Applications to Containers, is available that describes best practices that
Micro Focus recommends you adopt when moving an existing COBOL application to run in a containerized environment. See
Micro Focus: Best Practices for Moving Your COBOL Applications to Containers for more information.
Before you follow the steps in this topic you must have built a base image for
Enterprise Developer Build Tools for Windows. For information on creating a base image for
Enterprise Developer Build Tools for Windows see
Building a Base Image Containing
Enterprise Developer Build Tools for Windows.
Note: Remember that
Enterprise Developer is a development and test environment so not for use in production situations. If you want to run COBOL applications in containers
in a production environment you must use containers that contain
Enterprise Server.
Before building an image containing an application to
use with
Enterprise Developer Build Tools for Windows you need to ensure that you have available the following:
- A base image for
Enterprise Developer Build Tools for Windows. If you have not yet built such an image, see
Building a Base Image Containing
Enterprise Developer Build Tools for Windows for information on how to build one.
To build an image that includes an application to
use with
Enterprise Developer Build Tools for Windows your Dockerfile needs to perform the following steps:
- Specify a base image to work from. This should be an image containing only
Enterprise Developer Build Tools for Windows which was built for 32-bit or 64-bit as required and includes the additional build functionality, typically
microfocus/edbuildtools-build:win_7.0_x86 or
microfocus/edbuildtools-build:win_7.0_x64.
See
Building a Base Image Containing
Enterprise Developer Build Tools for Windows for more information.
- Define metadata for your image. This will make it easier to establish significant details of the image when you use the
docker inspect command.
- Define any variables for filenames and folder locations.
Note: If you will be using this image to run applications under Enterprise Server, you need to set the MFDS_EXTERNAL_ADDR environment
variable to specify a resolvable external address string. This is to enable client browsers to resolve the URLs used by ESMAC
and other utilities in Enterprise Server Administration.
The value that you specify for this environment variable is used to replace the internal container address in the URL.
- Copy the source files for your application to a folder on the image's filesystem and set the working directory to that folder.
- Perform whatever processing you need to do on your application's source file. This would typically be compiling and building
but could be anything that you can do with
Enterprise Developer Build Tools for Windows.
- Copy your built application files to the required folder on the image's filesystem and set the working directory to that folder.
- If the application is
.NET COBOL, ensure that the image includes the required support files. See
Debugging
.NET COBOL Applications Running in Containers for more information.
- Wait until Micro Focus Directory Server (MFDS) is running, then configure and start any required enterprise server regions.
You should consider putting the commands to perform these operations in a separate script. The CICS container demonstration
uses a script called
DeployAndWait.ps1.
- Perform any required clean-up. This includes tasks such as resetting variables and deleting temporary folders.
- Specify the name of the executable to run when the image is run.
Note: When starting a container that includes an application to be run under
Enterprise Developer Build Tools for Windows, to be able to manage the container's enterprise servers using Micro Focus Directory Server (MFDS) and Enterprise Server
Monitor and Control (ESMAC) from a machine other than the host machine you must specify some additional parameters on the
docker run command. The additional parameters are:
- -p to map the container's port to a port on the host computer
- -e to specify the MFDS_EXTERNAL_ADDR environment variable, which is used to specify the name of the host computer where the
container is running.
For example, when running an image for the CICS container demonstration you should ensure the
docker run command contains parameters such as the following:
-p 16001:86/udp -p16001:86/tcp -p 9000-9010:9000-9010 -e MFDS_EXTERNAL_ADDR=host-computer-name