Building an Image Containing an Application to use with Visual COBOL Build Tools for Windows

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 Visual COBOL Build Tools for Windows.

Before you follow the steps in this topic you must have built a base image for Visual COBOL Build Tools for Windows. For information on creating a base image for Visual COBOL Build Tools for Windows see Building a Base Image Containing Visual COBOL Build Tools for Windows.

Note: Remember that Visual COBOL 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 COBOL Server.

Before building an image containing an application to use with Visual COBOL Build Tools for Windows you need to ensure that you have available the following:

To build an image that includes an application to use with Visual COBOL Build Tools for Windows your Dockerfile needs to perform the following steps:

  1. Specify a base image to work from. This should be an image containing only Visual COBOL Build Tools for Windows which was built for 32-bit or 64-bit as required and includes the additional build functionality, typically microfocus/vcbuildtools-build:win_4.0_x86or microfocus/vcbuildtools-build:win_4.0_x64.

    See Building a Base Image Containing Visual COBOL Build Tools for Windows for more information.

  2. Define metadata for your image. This will make it easier to establish significant details of the image when you use the docker inspect command.
  3. 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.

  4. Copy the source files for your application to a folder on the image's filesystem and set the Docker working directory to that folder.
  5. 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 Visual COBOL Build Tools for Windows.
  6. Copy your built application files to the required folder on the image's filesystem and set the Docker working directory to that folder.
  7. If the application is managed COBOL, ensure that the image includes the required support files. See Debugging Managed COBOL Applications Running in Containers for more information.
  8. Perform any required clean-up. This includes tasks such as resetting variables and deleting temporary folders.
  9. Specify the name of the executable to run when the image is run.

The above process is used by the Docker demonstrations that create images for applications that you can use with Visual COBOL Build Tools for Windows. For more information on one of those demonstrations, including information on all the files it contains and a detailed description of the Dockerfiles it contains, see The Hello World Docker Demonstration.