This topic outlines the steps that a Dockerfile must carry out to create a base image for
Visual COBOL Build Tools for Windows.
By far the easiest, and the recommended, way to create a base image for
Visual COBOL Build Tools for Windows is to use the container demonstration as described in
The Container Demonstration for the
Visual COBOL Base Image. If you do use the container demonstration, you do not need to perform any of the steps described in this topic because the
container demonstration does them all for you. The information in this topic is provided if you choose to write your own Dockerfile
to create a
Visual COBOL Build Tools for Windows base image.
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.
Once you have built your
Visual COBOL Build Tools for Windows base image you can then build additional images, based on the base image, that include your COBOL applications as well as
Visual COBOL Build Tools for Windows. For more information on creating those additional images see
Building an Image Containing an Application to use with
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.
Prerequisites
Before building a base image for
Visual COBOL Build Tools for Windows you need to ensure that you have available the following:
- The installable executable file for
Visual COBOL Build Tools for Windows. This is
vcbt_80.exe and is supplied in the container demonstration for the
Visual COBOL Build Tools for Windows base image.
- The appropriate license (.mflic or
.xml) file for
Visual COBOL Build Tools for Windows.
- If you will be including Java support in the image, the relevant executable file to perform the installation of the JDK. You
can get this file from your chosen JDK provider.
Building a base image
To build a base image that includes
Visual COBOL Build Tools for Windows your Dockerfile needs to perform the following steps:
- Specify a base image to work from. This will typically be
microsoft/dotnet-framework or
microsoft/dotnet-framework-build.
When creating a base image containing
Visual COBOL Build Tools for Windows you might want to create two different versions of the image - a regular image (which is built from
microsoft/dotnet-framework) and a "-build" image (which is built from
microsoft/dotnet-framework-build). The
microsoft/dotnet-framework-build image includes build-related files that are not included in
microsoft/dotnet-framework, so while an image built from
microsoft/dotnet-framework will let you run applications, if you want to build applications you should use
microsoft/dotnet-framework-build.
Note: Because
microsoft/dotnet-framework-build contains additional files that are not included in
microsoft/dotnet-framework, for the sake of keeping container sizes to a minimum you should only use
microsoft/dotnet-framework-build when you need the additional build-related features.
The container demonstration that builds the base image containing
Visual COBOL Build Tools for Windows uses this approach, creating both
microfocus/vcbuildtools:win_8.0 and
microfocus/vcbuildtools-build:win_8.0.
- 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 installable executable file for
Visual COBOL Build Tools for Windows (vcbt_80.exe) from your host machine to a temporary folder in the image's filesystem, then run it to install
Visual COBOL Build Tools for Windows.
When running
vcbt_80.exe you need to specify the following parameters:
- /q
- to run the installaton silently; that is non-interactively with no user interface, using defaults for any values that are
not specified elsewhere on the command line.
- InstallFolder=installation-location
- to specify the name of the folder into which you want to install
Visual COBOL Build Tools for Windows. This a folder that you must have created on the image's filesystem.
- /l
log-file-name
- to create a log file of the installation.
- accepteula=yes
- to indicate that you accept the terms of the
Micro Focus End User License Agreement (EULA).
- Check the log file produced by the installation to ensure that the installation was successful.
- Use the
MFLicenseAdmin.exe utility to install the license for
Visual COBOL Build Tools for Windows.
- Set up the Ant and Java support.
- Perform any required clean-up. This includes tasks such as resetting variables and deleting temporary folders.
- Set the working directory to be the folder into which you installed
Visual COBOL Build Tools for Windows.
Note: Micro Focus recommends that in addition to having a Dockerfile that performs the above steps you have additional Dockerfiles
to create platform-specific versions of the
Visual COBOL Build Tools for Windows base image. These additional Dockerfiles will be very simple, using the
Visual COBOL Build Tools for Windows base image as their base then running commands to ensure that the correct (32-bit or 64-bit) environment is set up.
You could also choose to create a base image for
Visual COBOL Build Tools for Windows that doesn't include Java support. If you need to do this you would simply modify the above process to not perform the step
related to setting up the Java support.
If you want to create a base image for
Visual COBOL Build Tools for Windows that enables you to you debug
.NET COBOL applications you need to ensure that the image includes the required support files. See
Debugging
.NET COBOL Applications Running in Containers for more information.