To add a Dockerfile to a native COBOL project

Note: This topic only applies to using native COBOL applications in containers. To use JVM COBOL applications in containers you need to use the functionality described in Debugging and Running JVM COBOL Applications in Containers.

Visual COBOL lets you add a Dockerfile to a native COBOL project to simplify the process of containerizing an existing application. The Dockerfile created by Visual COBOL uses default values for details such as image names and includes basic instructions in order to create an image for the native COBOL project. If you need the Dockerfile to use non-default settings or to perform additional processing you can modify it once Visual COBOL has added it to your project.

Note: As part of the Dockerfile creation process you can specify that the Dockerfile is to include commands to configure an enterprise server, the details of which are specified in an XML file that was created either by the casesxml import/export utility or from Server Explorer. The XML file must be available for selection from the Select Server Definition XML dialog box, so if you do want to use an XML file you must add it to your project before you add a Dockerfile to your project.

See casesxml for more information on the casesxml command, To export an enterprise server instance for information on using Server Explorer to export an enterprise server definition, and To import a file into a project for information on adding a file to your project.

  1. Right-click your project in the Application Explorer view, COBOL Explorer view or Project Explorer view, and click New > Dockerfile.

    The New Dockerfile wizard is displayed.

  2. Select the relevant option depending on whether you want your Dockerfile to include instructions to define:
    • no enterprise servers
    • an enterprise server with the same configuration the one associated with this project (if there is one)
    • an enterprise server whose configuration is defined in exported XML file.

    If you want to use an exported XML file:

    1. Select Add instructions to configure an Enterprise Server using an XML file.
    2. Click Browse.

      The Select Server Definition XML dialog box is displayed.

    3. Navigate to the XML file that you want to use, select it, then click OK. The XML file must be in the folder structure for the current project.
  3. Click Finish.

    The Dockerfile is created and opened in the Dockerfile editor. If the project already contained a Dockerfile it is renamed to Dockerfile.bak.

Note:
  • If you need to modify the Dockerfile created by Visual COBOL, Micro Focus recommends that you maintain the same structure that is used by the one created by Visual COBOL.If you change the name of the "base" stage you must specify the new name in the project properties, as described in To specify project properties for containers.

    You might want to look at some of the Dockerfiles supplied with the Visual COBOL container demonstrations for guidance on the sort of changes to make.

  • Although it is possible to create a Dockerfile and manually add it to a native COBOL project Micro Focus recommends that you use the New > Dockerfile option in order to ensure that your development environment is correctly configured for working with containers.